Print cryptography package version

This commit is contained in:
Paul Tremberth 2017-09-07 11:37:40 +02:00
parent b8fabeed86
commit abaf466bb3
2 changed files with 11 additions and 2 deletions

View File

@ -23,8 +23,11 @@ class Command(ScrapyCommand):
def run(self, args, opts):
if opts.verbose:
for name, version in scrapy_components_versions():
print("%-9s : %s" % (name, version))
versions = scrapy_components_versions()
width = max(len(n) for (n, _) in versions)
patt = "%-{}s : %s".format(width)
for name, version in versions:
print(patt % (name, version))
else:
print("Scrapy %s" % scrapy.__version__)

View File

@ -17,6 +17,11 @@ def scrapy_components_versions():
w3lib_version = w3lib.__version__
except AttributeError:
w3lib_version = "<1.14.3"
try:
import cryptography
cryptography_version = cryptography.__version__
except ImportError:
cryptography_version = "unknown"
return [
("Scrapy", scrapy.__version__),
@ -28,6 +33,7 @@ def scrapy_components_versions():
("Twisted", twisted.version.short()),
("Python", sys.version.replace("\n", "- ")),
("pyOpenSSL", _get_openssl_version()),
("cryptography", cryptography_version),
("Platform", platform.platform()),
]