mirror of https://github.com/scrapy/scrapy.git
Added verbose option to 'version' command. Closes #298
This commit is contained in:
parent
6f2cea4775
commit
119fd20e91
|
|
@ -41,6 +41,10 @@ guidelines when reporting a new bug.
|
|||
reproduce the bug, so please include all relevant files required to reproduce
|
||||
it.
|
||||
|
||||
* 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
|
||||
===============
|
||||
|
||||
|
|
|
|||
|
|
@ -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:: deploy
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,29 @@
|
|||
import sys
|
||||
import platform
|
||||
|
||||
import twisted
|
||||
|
||||
import scrapy
|
||||
from scrapy.command import ScrapyCommand
|
||||
|
||||
class 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__
|
||||
|
|
|
|||
Loading…
Reference in New Issue