Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

use git describe for building version from git, and removed support for building version from hg

Pablo Hoffmanb6220b8e9503
diff --git a/setup.py b/setup.py
index 2072b37df..0225a391a 100644
--- a/setup.py
+++ b/setup.py
@@ -82,14 +82,10 @@ scripts = ['bin/scrapy']
if os.name == 'nt':
scripts.append('extras/scrapy.bat')
-if os.environ.get('SCRAPY_VERSION_FROM_HG'):
- rev = Popen(["hg", "tip", "--template", "{rev}"], stdout=PIPE).communicate()[0]
+if os.environ.get('SCRAPY_VERSION_FROM_GIT'):
+ v = Popen("git describe", 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)
-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())
+ f.write("\n__version__ = '%s'" % v.strip())
version = __import__('scrapy').__version__
setup_args = {