diff options
Diffstat (limited to 'configure.py')
-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) |