diff options
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/configure.py b/configure.py index 8c1118cc4..6c50bb596 100755 --- a/configure.py +++ b/configure.py @@ -1942,16 +1942,41 @@ def main(argv = None): # Now begin the actual IO to setup the build + def robust_rmtree(path, max_retries=5): + for i in range(max_retries): + try: + shutil.rmtree(path) + return + except OSError, e: + time.sleep(i) + + # Final attempt, pass any Exceptions up to caller. + shutil.rmtree(path) + + def robust_makedirs(dir, max_retries=5): + for i in range(max_retries): + try: + os.makedirs(dir) + return + except OSError, e: + if e.errno == errno.EEXIST: + return + else: + time.sleep(i) + + # Final attempt, pass any Exceptions up to caller. + os.makedirs(dir) + try: if options.clean_build_tree: - shutil.rmtree(build_config.build_dir) + robust_rmtree(build_config.build_dir) except OSError as e: if e.errno != errno.ENOENT: logging.error('Problem while removing build dir: %s' % (e)) for dir in build_config.build_dirs: try: - os.makedirs(dir) + robust_makedirs(dir) except OSError as e: if e.errno != errno.EEXIST: logging.error('Error while creating "%s": %s' % (dir, e)) |