Skip to content

Commit

Permalink
Print cryptography package version
Browse files Browse the repository at this point in the history
  • Loading branch information
redapple committed Sep 7, 2017
1 parent b8fabee commit abaf466
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scrapy/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ def add_options(self, parser):

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__)

6 changes: 6 additions & 0 deletions scrapy/utils/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__),
Expand All @@ -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()),
]

Expand Down

0 comments on commit abaf466

Please sign in to comment.