Define PermissionError in Python versions < 3.3 by cclauss · Pull Request #830 · gitpython-developers/GitPython
try: PermissionError except NameError: # Python < 3.3 PermissionError = OSError
execute_kwargs = {'istream', 'with_extended_output', 'with_exceptions', 'as_process', 'stdout_as_string',
# test if the new git executable path is valid
if sys.version_info < (3,): # - a GitCommandNotFound error is spawned by ourselves # - a OSError is spawned if the git executable provided # cannot be executed for whatever reason exceptions = (GitCommandNotFound, OSError) else: # - a GitCommandNotFound error is spawned by ourselves # - a PermissionError is spawned if the git executable provided # cannot be executed for whatever reason exceptions = (GitCommandNotFound, PermissionError)
# - a GitCommandNotFound error is spawned by ourselves # - a PermissionError is spawned if the git executable provided # cannot be executed for whatever reason
has_git = False try: cls().version() has_git = True except exceptions: except (GitCommandNotFound, PermissionError): pass
# warn or raise exception if test failed