-
Notifications
You must be signed in to change notification settings - Fork 419
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
Add an informative __main__.py #620
Conversation
Give users an easy way to figure out what versions they're running.
Codecov Report
@@ Coverage Diff @@
## master #620 +/- ##
==========================================
+ Coverage 96.78% 96.79% +<.01%
==========================================
Files 16 18 +2
Lines 5628 5642 +14
Branches 392 393 +1
==========================================
+ Hits 5447 5461 +14
Misses 121 121
Partials 60 60
Continue to review full report at Codecov.
|
FTR, on my computer the output looks like this:
That should be helpful when pinning down packaging problems. Opinions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a note in CONTRIBUTING.rst
suggesting that users include the output in their bug report?
I would even add a bug template…BUT: not before it’s released? |
|
src/OpenSSL/__main__.py
Outdated
if __name__ != "__main__": | ||
raise ImportError("This module can't be imported.") | ||
|
||
wot = """\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what "wot" means, please use a real variable name.
src/OpenSSL/__main__.py
Outdated
|
||
|
||
if __name__ != "__main__": | ||
raise ImportError("This module can't be imported.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code should go in a main function which is invoked in the __main__
block, that way it can be tested in memory
src/OpenSSL/__main__.py
Outdated
wot = """\ | ||
pyOpenSSL: {pyopenssl} | ||
cryptography: {cryptography} | ||
OpenSSL: {openssl} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to distinguish between the linked version of OpenSSL and the compiled-against version.
I wasn’t quite sure what you meant with linked/compiled? I’ve added the OpenSSL the Python ist compiled against, since that is occasionally useful too:
|
I’ve add the cffi version which is (not only) interesting for #622. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, besides this LGTM
src/OpenSSL/debug/__main__.py
Outdated
@@ -0,0 +1,36 @@ | |||
from __future__ import print_function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be a package, just debug.py
is sufficient.
When @alex said linked vs compiled he meant that when cryptography is compiled the OpenSSL headers are used to determine version. You can obtain the version that was seen during the compile phase with |
Give users an easy way to figure out what versions they're running.
These questions come up with every bug.