Skip to content

Fix setup.py and use of requirements files and add a docker test container #826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 5, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update cmd.py, fix PermissionError issue using best practices
This closes #830
  • Loading branch information
cclauss authored and jeking3 committed Mar 15, 2019
commit 48b7e12fc075d8fe35ee8e4b0167054130d6a514
22 changes: 9 additions & 13 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
stream_copy,
)

try:
PermissionError
except NameError: # Python < 3.3
PermissionError = OSError

execute_kwargs = {'istream', 'with_extended_output',
'with_exceptions', 'as_process', 'stdout_as_string',
Expand Down Expand Up @@ -211,23 +215,15 @@ def refresh(cls, path=None):

# 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) # noqa
# (silence erroneous flake8 F821)

# - 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
Expand Down