Skip to content
Permalink
Browse files

Add openssl version to version command

  • Loading branch information
dangra committed Aug 12, 2015
1 parent 83a06ed commit 13c45aca0fc88f11e16d36175cfd4bec21c4da39
Showing with 18 additions and 6 deletions.
  1. +18 −6 scrapy/commands/version.py
@@ -3,6 +3,7 @@
import platform

import twisted
import OpenSSL

import scrapy
from scrapy.commands import ScrapyCommand
@@ -26,11 +27,22 @@ def run(self, args, opts):
import lxml.etree
lxml_version = ".".join(map(str, lxml.etree.LXML_VERSION))
libxml2_version = ".".join(map(str, lxml.etree.LIBXML_VERSION))
print("Scrapy : %s" % scrapy.__version__)
print("lxml : %s" % lxml_version)
print("libxml2 : %s" % libxml2_version)
print("Twisted : %s" % twisted.version.short())
print("Python : %s" % sys.version.replace("\n", "- "))
print("Platform: %s" % platform.platform())
print("Scrapy : %s" % scrapy.__version__)
print("lxml : %s" % lxml_version)
print("libxml2 : %s" % libxml2_version)
print("Twisted : %s" % twisted.version.short())
print("Python : %s" % sys.version.replace("\n", "- "))
print("pyOpenSSL : %s" % self._get_openssl_version())
print("Platform : %s" % platform.platform())
else:
print("Scrapy %s" % scrapy.__version__)

def _get_openssl_version(self):
try:
openssl = OpenSSL.SSL.SSLeay_version(OpenSSL.SSL.SSLEAY_VERSION)\
.decode('ascii', errors='replace')
# pyOpenSSL 0.12 does not expose openssl version
except AttributeError:
openssl = 'Unknown OpenSSL version'

return '{} ({})'.format(OpenSSL.version.__version__, openssl)

0 comments on commit 13c45ac

Please sign in to comment.
You can’t perform that action at this time.