diff options
author | Stephan Altmueller <stephana@google.com> | 2017-03-24 13:19:04 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-27 13:39:27 +0000 |
commit | 90d80f81e988ba7e6f0dbf78220b5b7cd31a527b (patch) | |
tree | 13c9533d9693eab9b7a31531d351ac4d4a888257 /testing/tools | |
parent | 2977e1e342a12f51618d784fe704080fe37fa203 (diff) | |
download | pdfium-90d80f81e988ba7e6f0dbf78220b5b7cd31a527b.tar.xz |
Ensure empty output directory to avoid duplicate upload
BUG=
Change-Id: I491460db0b73e5f6fe0731611400af30e6458537
Reviewed-on: https://pdfium-review.googlesource.com/3121
Reviewed-by: Wei Li <weili@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/tools')
-rw-r--r-- | testing/tools/gold.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/testing/tools/gold.py b/testing/tools/gold.py index db3bf81b73..bdae9f4195 100644 --- a/testing/tools/gold.py +++ b/testing/tools/gold.py @@ -56,7 +56,8 @@ class GoldResults(object): """ source_type is the source_type (=corpus) field used for all results. output_dir is the directory where the resulting images are copied and - the dm.json file is written. + the dm.json file is written. If the directory exists it will + be removed and recreated. propertiesStr is a string with space separated key/value pairs that is used to set the top level fields in the output JSON file. keyStr is a string with space separated key/value pairs that @@ -70,9 +71,10 @@ class GoldResults(object): self._results = [] self._outputDir = outputDir - # make sure the output directory exists. - if not os.path.exists(outputDir): - os.makedirs(outputDir) + # make sure the output directory exists and is empty. + if os.path.exists(outputDir): + shutil.rmtree(outputDir, ignore_errors=True) + os.makedirs(outputDir) self._ignore_hashes = set() if ignore_hashes_file: |