|  | 
| 43 | 43 |     stream_copy, | 
| 44 | 44 | ) | 
| 45 | 45 | 
 | 
|  | 46 | +try: | 
|  | 47 | +    PermissionError | 
|  | 48 | +except NameError:  # Python < 3.3 | 
|  | 49 | +    PermissionError = OSError | 
| 46 | 50 | 
 | 
| 47 | 51 | execute_kwargs = {'istream', 'with_extended_output', | 
| 48 | 52 |                   'with_exceptions', 'as_process', 'stdout_as_string', | 
| @@ -211,23 +215,15 @@ def refresh(cls, path=None): | 
| 211 | 215 | 
 | 
| 212 | 216 |         # test if the new git executable path is valid | 
| 213 | 217 | 
 | 
| 214 |  | -        if sys.version_info < (3,): | 
| 215 |  | -            # - a GitCommandNotFound error is spawned by ourselves | 
| 216 |  | -            # - a OSError is spawned if the git executable provided | 
| 217 |  | -            #   cannot be executed for whatever reason | 
| 218 |  | -            exceptions = (GitCommandNotFound, OSError) | 
| 219 |  | -        else: | 
| 220 |  | -            # - a GitCommandNotFound error is spawned by ourselves | 
| 221 |  | -            # - a PermissionError is spawned if the git executable provided | 
| 222 |  | -            #   cannot be executed for whatever reason | 
| 223 |  | -            exceptions = (GitCommandNotFound, PermissionError)  # noqa | 
| 224 |  | -            #                           (silence erroneous flake8 F821) | 
| 225 |  | - | 
|  | 218 | +        # - a GitCommandNotFound error is spawned by ourselves | 
|  | 219 | +        # - a PermissionError is spawned if the git executable provided | 
|  | 220 | +        #   cannot be executed for whatever reason | 
|  | 221 | +         | 
| 226 | 222 |         has_git = False | 
| 227 | 223 |         try: | 
| 228 | 224 |             cls().version() | 
| 229 | 225 |             has_git = True | 
| 230 |  | -        except exceptions: | 
|  | 226 | +        except (GitCommandNotFound, PermissionError): | 
| 231 | 227 |             pass | 
| 232 | 228 | 
 | 
| 233 | 229 |         # warn or raise exception if test failed | 
|  | 
0 commit comments