Skip to content

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

improved mechanism for tagging version with hg revision

Pablo Hoffman97a790d6597b
diff --git a/scrapy/__init__.py b/scrapy/__init__.py
index 287d5f6cc..84cf85e67 100644
--- a/scrapy/__init__.py
+++ b/scrapy/__init__.py
@@ -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
diff --git a/setup.py b/setup.py
index 15884e89e..e542cb65a 100644
--- a/setup.py
+++ b/setup.py
@@ -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',