diff options
author | Alexandre Rames <alexandre.rames@linaro.org> | 2015-10-12 13:44:22 +0100 |
---|---|---|
committer | Alexandre Rames <alexandre.rames@linaro.org> | 2015-10-12 13:44:22 +0100 |
commit | 738174fb93eb8487ac711e93018d126c7490cda7 (patch) | |
tree | 796139b796e1145599bf2b6f4b88b4e4d45da03f | |
parent | c95f35c33ed628036a04bd457dee1a0872c692cb (diff) |
Do not put `.pkl` files in the build directory.
The `build` directory is automatically deleted by the `build.sh` script run as
part of `run.py`, and we want to keep `.pkl` files across runs.
Change-Id: Ia652f50731da42f8362cfa0b778b16db3fc62cb5
-rwxr-xr-x | run.py | 8 | ||||
-rw-r--r-- | tools/utils.py | 5 |
2 files changed, 10 insertions, 3 deletions
@@ -258,10 +258,12 @@ if __name__ == "__main__": print('') # Write the results to a file so they can later be used with `compare.py`. if args.output_pkl is None: - res_file = 'res.' + time.strftime("%Y.%m.%d-%H:%M:%S") + '.pkl' - res_file = os.path.join(utils.dir_build, res_file) + default_pkl_out_dir = os.path.join(utils.dir_root, 'pkl') + utils.ensure_dir(default_pkl_out_dir) + res_file = 'res.' + time.strftime("%Y.%m.%d-%H:%M:%S") + '.pkl' + res_file = os.path.join(default_pkl_out_dir, res_file) else: - res_file = args.output_pkl + res_file = args.output_pkl with open(res_file, 'wb') as pickle_file: pickle.dump(result, pickle_file) print(('Wrote results to %s.' % res_file)) diff --git a/tools/utils.py b/tools/utils.py index b5bb694..1ae60c3 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -24,3 +24,8 @@ dir_benchmarks = os.path.join(dir_root, 'benchmarks') dir_build = os.path.join(dir_root, 'build') dir_build_java_classes = os.path.join(dir_build, 'classes') dir_framework = os.path.join(dir_root, 'framework') + + +def ensure_dir(path_name): + if not os.path.exists(path_name): + os.makedirs(path_name) |