diff options
author | Daniel Neus <[email protected]> | 2015-12-23 13:14:47 +0100 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2015-12-23 13:14:47 +0100 |
commit | daadca1b242023c2efbc3536561af42250643912 (patch) | |
tree | 064d11d9bfa9d13978f14c4ba92341649f584201 /configure.py | |
parent | 001defdee387087ab35946f148549f4eeb9cddfb (diff) |
review changes
* fix Python 3 compatibility
* add comment explaining purpose of the workarounds
* raise exception if directory exists in robust_makedirs
* pylint fixes
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/configure.py b/configure.py index f231a54a9..7c73b15fa 100755 --- a/configure.py +++ b/configure.py @@ -1942,25 +1942,27 @@ 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 i in range(max_retries): + for _ in range(max_retries): try: shutil.rmtree(path) return - except OSError, e: + except OSError: time.sleep(0.1) # Final attempt, pass any Exceptions up to caller. shutil.rmtree(path) - def robust_makedirs(dir, max_retries=5): - for i in range(max_retries): + # 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(dir) + os.makedirs(directory) return - except OSError, e: + except OSError as e: if e.errno == errno.EEXIST: - return + raise else: time.sleep(0.1) |