Scrapy, a fast high-level web crawling & scraping framework for Python.
added support for generating version from git revision, and use it in extras/makedeb.py
Pablo Hoffman1e43afeaea4c
diff --git a/extras/makedeb.py b/extras/makedeb.pyindex ca1b69470..63410b2df 100644--- a/extras/makedeb.py+++ b/extras/makedeb.py@@ -16,7 +16,7 @@ def build(suffix):with open(ifn, 'w') as of:of.write(s)- env={'SCRAPY_VERSION_FROM_HG': '1'}+ env={'SCRAPY_VERSION_FROM_GIT': '1'}check_call('debchange -m -D unstable --force-distribution -v $(python setup.py --version)+$(date +%s) "Automatic build"', \shell=True, env=env)check_call('debuild -us -uc -b', shell=True)diff --git a/setup.py b/setup.pyindex a2ac7cc28..2072b37df 100644--- a/setup.py+++ b/setup.py@@ -86,6 +86,10 @@ if os.environ.get('SCRAPY_VERSION_FROM_HG'):rev = Popen(["hg", "tip", "--template", "{rev}"], stdout=PIPE).communicate()[0]with open('scrapy/__init__.py', 'a') as f:f.write("\n__version__ = '.'.join(map(str, version_info)) + '.%s'" % rev)+elif os.environ.get('SCRAPY_VERSION_FROM_GIT'):+ rev = Popen("git log --oneline | wc -l", shell=True, stdout=PIPE).communicate()[0]+ with open('scrapy/__init__.py', 'a') as f:+ f.write("\n__version__ = '.'.join(map(str, version_info)) + '.%s'" % rev.strip())version = __import__('scrapy').__version__setup_args = {