Skip to content
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

Handle missing GPG executable graciously #484

Merged
merged 4 commits into from
Aug 8, 2019

Conversation

allhailwesttexas
Copy link
Contributor

If GPG not installed, handle the FileNotFound exception.
Fall back to trying with gpg2 if the original call was to gpg.

Closes #456

If GPG not installed, handle the FileNotFound exception.
Fall back to trying with gpg2 if the original call was to gpg.
@allhailwesttexas
Copy link
Contributor Author

I've added some print() statements here, but happy to change if this seems too verbose.

@allhailwesttexas
Copy link
Contributor Author

Looks like py2 doesn't have FileNotFoundError...let me see what I can do.

@codecov
Copy link

codecov bot commented Aug 6, 2019

Codecov Report

Merging #484 into master will increase coverage by 0.32%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #484      +/-   ##
==========================================
+ Coverage   84.24%   84.56%   +0.32%     
==========================================
  Files          14       14              
  Lines         768      784      +16     
  Branches      114      115       +1     
==========================================
+ Hits          647      663      +16     
- Misses         84       85       +1     
+ Partials       37       36       -1
Impacted Files Coverage Δ
twine/exceptions.py 100% <100%> (ø) ⬆️
twine/package.py 89.92% <100%> (+1.22%) ⬆️
twine/wininst.py 31.57% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 579f3fe...1355868. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 6, 2019

Codecov Report

Merging #484 into master will increase coverage by 0.38%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #484      +/-   ##
==========================================
+ Coverage   84.24%   84.62%   +0.38%     
==========================================
  Files          14       14              
  Lines         768      787      +19     
  Branches      114      115       +1     
==========================================
+ Hits          647      666      +19     
  Misses         84       84              
  Partials       37       37
Impacted Files Coverage Δ
twine/exceptions.py 100% <100%> (ø) ⬆️
twine/package.py 90.15% <100%> (+1.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 579f3fe...87957a8. Read the comment docs.

twine/package.py Outdated
print("{} executable not available.".format(gpg_args[0]))

if not gpg_args[0] == "gpg":
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

gpg_args[0] != "gpg"

And in this case, if we've tried with gpg2 (which I presume is the assumption made here) we should not just silently allow a failure. People are expecting signatures to be generated, we must raise an exception and halt progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I've updated the PR so that we always raise exception if not able to sign.

@allhailwesttexas
Copy link
Contributor Author

Travis had some connection issues, so I closed/reopened to rerun CI verification.

@sigmavirus24 sigmavirus24 merged commit 84f1a69 into pypa:master Aug 8, 2019
@sigmavirus24
Copy link
Member

Thank you! 🎉

@di
Copy link
Sponsor Member

di commented Aug 8, 2019

@allhailwesttexas Can you add an entry to the changelog?

@allhailwesttexas
Copy link
Contributor Author

@di No worries, it is done: #487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FileNotFoundError: [Errno 2] No such file or directory: 'gpg': 'gpg'
3 participants