debug.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from __future__ import print_function
  2. import ssl
  3. import sys
  4. import OpenSSL.SSL
  5. import cffi
  6. import cryptography
  7. from . import version
  8. _env_info = """\
  9. pyOpenSSL: {pyopenssl}
  10. cryptography: {cryptography}
  11. cffi: {cffi}
  12. cryptography's compiled against OpenSSL: {crypto_openssl_compile}
  13. cryptography's linked OpenSSL: {crypto_openssl_link}
  14. Python's OpenSSL: {python_openssl}
  15. Python executable: {python}
  16. Python version: {python_version}
  17. Platform: {platform}
  18. sys.path: {sys_path}""".format(
  19. pyopenssl=version.__version__,
  20. crypto_openssl_compile=OpenSSL._util.ffi.string(
  21. OpenSSL._util.lib.OPENSSL_VERSION_TEXT,
  22. ).decode("ascii"),
  23. crypto_openssl_link=OpenSSL.SSL.SSLeay_version(
  24. OpenSSL.SSL.SSLEAY_VERSION
  25. ).decode("ascii"),
  26. python_openssl=getattr(ssl, "OPENSSL_VERSION", "n/a"),
  27. cryptography=cryptography.__version__,
  28. cffi=cffi.__version__,
  29. python=sys.executable,
  30. python_version=sys.version,
  31. platform=sys.platform,
  32. sys_path=sys.path,
  33. )
  34. if __name__ == "__main__":
  35. print(_env_info)