|
11 | 11 |
|
12 | 12 | from pip.exceptions import InstallationError, BadCommand
|
13 | 13 | from pip.backwardcompat import(
|
14 |
| - WindowsError, string_types, raw_input, console_to_str, |
15 |
| - PermissionError, stdlib_pkgs |
| 14 | + string_types, raw_input, console_to_str, stdlib_pkgs |
16 | 15 | )
|
17 | 16 | from pip.locations import (
|
18 | 17 | site_packages, user_site, running_under_virtualenv, virtualenv_no_global,
|
@@ -52,19 +51,15 @@ def rmtree_errorhandler(func, path, exc_info):
|
52 | 51 | """On Windows, the files in .svn are read-only, so when rmtree() tries to
|
53 | 52 | remove them, an exception is thrown. We catch that here, remove the
|
54 | 53 | read-only attribute, and hopefully continue without problems."""
|
55 |
| - exctype, value = exc_info[:2] |
56 |
| - if not ((exctype is WindowsError and value.args[0] == 5) or # others |
57 |
| - (exctype is OSError and value.args[0] == 13) or # python2.4 |
58 |
| - (exctype is PermissionError and value.args[3] == 5) # python3.3 |
59 |
| - ): |
60 |
| - raise |
61 |
| - # file type should currently be read only |
62 |
| - if ((os.stat(path).st_mode & stat.S_IREAD) != stat.S_IREAD): |
| 54 | + # if file type currently read only |
| 55 | + if os.stat(path).st_mode & stat.S_IREAD: |
| 56 | + # convert to read/write |
| 57 | + os.chmod(path, stat.S_IWRITE) |
| 58 | + # use the original function to repeat the operation |
| 59 | + func(path) |
| 60 | + return |
| 61 | + else: |
63 | 62 | raise
|
64 |
| - # convert to read/write |
65 |
| - os.chmod(path, stat.S_IWRITE) |
66 |
| - # use the original function to repeat the operation |
67 |
| - func(path) |
68 | 63 |
|
69 | 64 |
|
70 | 65 | def display_path(path):
|
|
0 commit comments