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

This commit is contained in:
Pablo Hoffman 2012-01-02 13:05:26 -02:00
parent 1f87d7ff4b
commit b6220b8e95
1 changed files with 3 additions and 7 deletions

View File

@ -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 = {