Scrapy, a fast high-level web crawling & scraping framework for Python.
Added verbose option to 'version' command. Closes #298
Pablo Hoffman119fd20e91d2
diff --git a/docs/contributing.rst b/docs/contributing.rstindex 1653ff352..d227b223e 100644--- a/docs/contributing.rst+++ b/docs/contributing.rst@@ -41,6 +41,10 @@ guidelines when reporting a new bug.reproduce the bug, so please include all relevant files required to reproduceit.+* include the output of ``scrapy version -v`` so developers working on your bug+ know exactly which version and platform it occurred on, which is often very+ helpful for reproducing it, or knowing if it was already fixed.+Writing patches===============diff --git a/docs/topics/commands.rst b/docs/topics/commands.rstindex 418648c8e..6b30a4e59 100644--- a/docs/topics/commands.rst+++ b/docs/topics/commands.rst@@ -413,10 +413,11 @@ Example usage::version--------* Syntax: ``scrapy version``+* Syntax: ``scrapy version [-v]``* Requires project: *no*-Prints the Scrapy version.+Prints the Scrapy version. If used with ``-v`` it also prints Python, Twisted+and Platform info, which is useful for bug reports... command:: deploydiff --git a/scrapy/commands/version.py b/scrapy/commands/version.pyindex 4d4557357..ef39f69fa 100644--- a/scrapy/commands/version.py+++ b/scrapy/commands/version.py@@ -1,10 +1,29 @@+import sys+import platform++import twisted+import scrapyfrom scrapy.command import ScrapyCommandclass Command(ScrapyCommand):+ def syntax(self):+ return "[-v]"+def short_desc(self):return "Print Scrapy version"+ def add_options(self, parser):+ ScrapyCommand.add_options(self, parser)+ parser.add_option("--verbose", "-v", dest="verbose", action="store_true",+ help="also display twisted/python/platform info (useful for bug reports)")+def run(self, args, opts):- print "Scrapy %s" % scrapy.__version__+ if opts.verbose:+ print "Scrapy : %s" % scrapy.__version__+ print "Twisted : %s" % twisted.version.short()+ print "Python : %s" % sys.version.replace("\n", "- ")+ print "Platform: %s" % platform.platform()+ else:+ print "Scrapy %s" % scrapy.__version__