summaryrefslogtreecommitdiff
path: root/src/OpenSSL/debug.py
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2017-05-13 17:44:27 +0200
committerPaul Kehrer <paul.l.kehrer@gmail.com>2017-05-13 10:44:27 -0500
commitd52975cef3a36e18552aeb23de7c06aa73d76454 (patch)
treea74830b8bdf3742062ded54b1ef1985e8d0063d9 /src/OpenSSL/debug.py
parent7706e1484fe6eab0ae35c103e5b89b7e16fca9a5 (diff)
downloadpyopenssl-d52975cef3a36e18552aeb23de7c06aa73d76454.tar.gz
Add an informative __main__.py (#620)
* Add an informative __main__.py Give users an easy way to figure out what versions they're running. * Why not more info! * Add test * No empty last line * Make @alex happy * DIAF Python 2.6 * Add cffi's version * Make debug a module * Add cryptography's compile-time OpenSSL
Diffstat (limited to 'src/OpenSSL/debug.py')
-rw-r--r--src/OpenSSL/debug.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/OpenSSL/debug.py b/src/OpenSSL/debug.py
new file mode 100644
index 0000000..0d37bf5
--- /dev/null
+++ b/src/OpenSSL/debug.py
@@ -0,0 +1,42 @@
+from __future__ import print_function
+
+import ssl
+import sys
+
+import OpenSSL.SSL
+import cffi
+import cryptography
+
+from . import version
+
+
+_env_info = u"""\
+pyOpenSSL: {pyopenssl}
+cryptography: {cryptography}
+cffi: {cffi}
+cryptography's compiled against OpenSSL: {crypto_openssl_compile}
+cryptography's linked OpenSSL: {crypto_openssl_link}
+Pythons's OpenSSL: {python_openssl}
+Python executable: {python}
+Python version: {python_version}
+Platform: {platform}
+sys.path: {sys_path}""".format(
+ pyopenssl=version.__version__,
+ crypto_openssl_compile=OpenSSL._util.ffi.string(
+ OpenSSL._util.lib.OPENSSL_VERSION_TEXT,
+ ).decode("ascii"),
+ crypto_openssl_link=OpenSSL.SSL.SSLeay_version(
+ OpenSSL.SSL.SSLEAY_VERSION
+ ).decode("ascii"),
+ python_openssl=getattr(ssl, "OPENSSL_VERSION", "n/a"),
+ cryptography=cryptography.__version__,
+ cffi=cffi.__version__,
+ python=sys.executable,
+ python_version=sys.version,
+ platform=sys.platform,
+ sys_path=sys.path,
+)
+
+
+if __name__ == "__main__":
+ print(_env_info)