improved mechanism for tagging version with hg revision

This commit is contained in:
Pablo Hoffman 2010-12-13 10:21:39 -02:00
parent 119fd20e91
commit 97a790d659
2 changed files with 7 additions and 3 deletions

View File

@ -2,7 +2,7 @@
Scrapy - a screen scraping framework written in Python
"""
version_info = (0, 11, 0, 'dev')
version_info = (0, 11, 0)
__version__ = "0.11.0"
import sys, os, warnings

View File

@ -2,6 +2,9 @@
#
# It doesn't depend on setuptools, but if setuptools is available it'll use
# some of its features, like package dependencies.
from __future__ import with_statement
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
from subprocess import Popen, PIPE
@ -79,10 +82,11 @@ scripts = ['bin/scrapy']
if os.name == 'nt':
scripts.append('extras/scrapy.bat')
version = __import__('scrapy').__version__
if os.environ.get('SCRAPY_VERSION_FROM_HG'):
rev = Popen(["hg", "tip", "--template", "{rev}"], stdout=PIPE).communicate()[0]
version = "%s.r%s" % (version, rev)
with open('scrapy/__init__.py', 'a') as f:
f.write("\n__version__ = '.'.join(map(str, version_info)) + '.%s'" % rev)
version = __import__('scrapy').__version__
setup_args = {
'name': 'Scrapy',