Merge pull request #2404 from redapple/scrapy-version

[MRG+1] Print more dependencies versions in "scrapy version" verbose output
This commit is contained in:
Mikhail Korobov 2016-11-30 17:01:37 +05:00 committed by GitHub
commit bba4645f21
2 changed files with 17 additions and 2 deletions

View File

@ -26,12 +26,25 @@ class Command(ScrapyCommand):
def run(self, args, opts):
if opts.verbose:
import cssselect
import parsel
import lxml.etree
import w3lib
lxml_version = ".".join(map(str, lxml.etree.LXML_VERSION))
libxml2_version = ".".join(map(str, lxml.etree.LIBXML_VERSION))
try:
w3lib_version = w3lib.__version__
except AttributeError:
w3lib_version = "<1.14.3"
print("Scrapy : %s" % scrapy.__version__)
print("lxml : %s" % lxml_version)
print("libxml2 : %s" % libxml2_version)
print("cssselect : %s" % cssselect.__version__)
print("parsel : %s" % parsel.__version__)
print("w3lib : %s" % w3lib_version)
print("Twisted : %s" % twisted.version.short())
print("Python : %s" % sys.version.replace("\n", "- "))
print("pyOpenSSL : %s" % self._get_openssl_version())

View File

@ -25,5 +25,7 @@ class VersionTest(ProcessTest, unittest.TestCase):
_, out, _ = yield self.execute(['-v'])
headers = [l.partition(":")[0].strip()
for l in out.strip().decode(encoding).splitlines()]
self.assertEqual(headers, ['Scrapy', 'lxml', 'libxml2', 'Twisted',
'Python', 'pyOpenSSL', 'Platform'])
self.assertEqual(headers, ['Scrapy', 'lxml', 'libxml2',
'cssselect', 'parsel', 'w3lib',
'Twisted', 'Python', 'pyOpenSSL',
'Platform'])