diff options
author | Simon Warta <[email protected]> | 2017-04-09 20:35:43 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2017-04-18 09:36:25 +0200 |
commit | 96ee2eaba55b3cff1252bd68c135d440e48d1615 (patch) | |
tree | b467036b79064a52573229eaf049516d3f585f2b | |
parent | a2c7a9fddfa2b3afba1cde0c5830e5e5f25249d9 (diff) |
Move robust_* out of main()
-rwxr-xr-x | configure.py | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/configure.py b/configure.py index df3e203f5..977859660 100755 --- a/configure.py +++ b/configure.py @@ -2514,6 +2514,35 @@ def load_info_files(descr, search_dir, filename_matcher, class_t): return info +# Workaround for Windows systems where antivirus is enabled GH #353 +def robust_rmtree(path, max_retries=5): + for _ in range(max_retries): + try: + shutil.rmtree(path) + return + except OSError: + time.sleep(0.1) + + # Final attempt, pass any exceptions up to caller. + shutil.rmtree(path) + + +# Workaround for Windows systems where antivirus is enabled GH #353 +def robust_makedirs(directory, max_retries=5): + for _ in range(max_retries): + try: + os.makedirs(directory) + return + except OSError as e: + if e.errno == errno.EEXIST: + raise + else: + time.sleep(0.1) + + # Final attempt, pass any exceptions up to caller. + os.makedirs(directory) + + def main(argv=None): """ Main driver @@ -2697,33 +2726,6 @@ def main(argv=None): # Now begin the actual IO to setup the build - # Workaround for Windows systems where antivirus is enabled GH #353 - def robust_rmtree(path, max_retries=5): - for _ in range(max_retries): - try: - shutil.rmtree(path) - return - except OSError: - time.sleep(0.1) - - # Final attempt, pass any exceptions up to caller. - shutil.rmtree(path) - - # Workaround for Windows systems where antivirus is enabled GH #353 - def robust_makedirs(directory, max_retries=5): - for _ in range(max_retries): - try: - os.makedirs(directory) - return - except OSError as e: - if e.errno == errno.EEXIST: - raise - else: - time.sleep(0.1) - - # Final attempt, pass any exceptions up to caller. - os.makedirs(directory) - try: if options.clean_build_tree: robust_rmtree(build_config.build_dir) |