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

Merged
merged 9 commits into from May 13, 2017

Conversation

Projects
None yet
4 participants
@hynek
Contributor

hynek commented Apr 20, 2017

Give users an easy way to figure out what versions they're running.

These questions come up with every bug.

Add an informative __main__.py
Give users an easy way to figure out what versions they're running.

@hynek hynek force-pushed the hynek:master branch from eca2845 to b982875 Apr 20, 2017

@codecov

This comment has been minimized.

codecov bot commented Apr 20, 2017

Codecov Report

Merging #620 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/OpenSSL/debug.py 100% <100%> (ø)
tests/test_debug.py 100% <100%> (ø)
tests/test_util.py 100% <100%> (ø) ⬆️

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 7706e14...a81358d. Read the comment docs.

hynek added some commits Apr 20, 2017

@hynek

This comment has been minimized.

Contributor

hynek commented Apr 20, 2017

FTR, on my computer the output looks like this:

➤ python -m OpenSSL
pyOpenSSL: 17.1.0.dev0
cryptography: 1.7.2
OpenSSL: OpenSSL 1.0.2k  26 Jan 2017
Python: /Users/hynek/.virtualenvs/pyopenssl/bin/python
Python version: 2.7.13 (default, Dec 26 2016, 08:37:46)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
Platform: darwin
sys.path: ['', '/Users/hynek/.virtualenvs/pyopenssl/lib/python27.zip', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/plat-darwin', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/plat-mac', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/lib-tk', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/lib-old', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/lib-dynload', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/plat-darwin', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/lib-tk', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/plat-mac', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/site-packages', '/Users/hynek/Projects/pyopenssl/src']

That should be helpful when pinning down packaging problems.

Opinions?

@alexwlchan

Worth a note in CONTRIBUTING.rst suggesting that users include the output in their bug report?

@hynek

This comment has been minimized.

Contributor

hynek commented Apr 20, 2017

I would even add a bug template…BUT: not before it’s released?

@alex

This comment has been minimized.

Member

alex commented Apr 20, 2017

-m OpenSSL is way too generic a name for this; maybe -m OpenSSL.debug or something.

if __name__ != "__main__":
raise ImportError("This module can't be imported.")
wot = """\

This comment has been minimized.

@alex

alex Apr 20, 2017

Member

I don't know what "wot" means, please use a real variable name.

if __name__ != "__main__":
raise ImportError("This module can't be imported.")

This comment has been minimized.

@alex

alex Apr 20, 2017

Member

This code should go in a main function which is invoked in the __main__ block, that way it can be tested in memory

wot = """\
pyOpenSSL: {pyopenssl}
cryptography: {cryptography}
OpenSSL: {openssl}

This comment has been minimized.

@alex

alex Apr 20, 2017

Member

You may want to distinguish between the linked version of OpenSSL and the compiled-against version.

@hynek

This comment has been minimized.

Contributor

hynek commented Apr 21, 2017

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:

pyOpenSSL: 17.1.0.dev0
cryptography: 1.7.2
cryptography's OpenSSL: OpenSSL 1.0.2k  26 Jan 2017
Pythons's OpenSSL: OpenSSL 1.0.2k  26 Jan 2017
Python executable: /Users/hynek/.virtualenvs/pyopenssl/bin/python
Python version: 2.7.13 (default, Dec 26 2016, 08:37:46)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
Platform: darwin
sys.path: ['', '/Users/hynek/.virtualenvs/pyopenssl/lib/python27.zip', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/plat-darwin', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/plat-mac', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/lib-tk', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/lib-old', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/lib-dynload', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/plat-darwin', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/lib-tk', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/plat-mac', '/Users/hynek/.pyenv/versions/2.7.13/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/hynek/.virtualenvs/pyopenssl/lib/python2.7/site-packages', '/Users/hynek/Projects/pyopenssl/src']

@hynek hynek force-pushed the hynek:master branch from 6c5dff7 to ae3b758 Apr 21, 2017

@hynek

This comment has been minimized.

Contributor

hynek commented Apr 25, 2017

I’ve add the cffi version which is (not only) interesting for #622.

@alex

One comment, besides this LGTM

@@ -0,0 +1,36 @@
from __future__ import print_function

This comment has been minimized.

@alex

alex May 13, 2017

Member

This doesn't need to be a package, just debug.py is sufficient.

@reaperhulk

This comment has been minimized.

Member

reaperhulk commented May 13, 2017

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 _util.lib.OPENSSL_VERSION_TEXT. The version that is actually loaded by the dynamic linker is obtained via the mechanism you already have in this PR. The reason it's interesting to see both is that sometimes people install cryptography/pyOpenSSL and then upgrade OpenSSL. This can occasionally cause problems and that makes it useful to see the mismatch

@reaperhulk reaperhulk merged commit d52975c into pyca:master May 13, 2017

3 checks passed

codecov/patch 100% of diff hit (target 96.78%)
Details
codecov/project 96.79% (+<.01%) compared to 7706e14
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment