mirror of https://github.com/scrapy/scrapy.git
get scrapy version from package data
This commit is contained in:
parent
79cb0318d0
commit
910effd145
|
|
@ -3,6 +3,7 @@ include AUTHORS
|
|||
include INSTALL
|
||||
include LICENSE
|
||||
include MANIFEST.in
|
||||
include scrapy/VERSION
|
||||
include scrapy/mime.types
|
||||
recursive-include scrapy/templates *
|
||||
recursive-include scrapy/tests/sample_data *
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ build:
|
|||
python extras/makedeb.py build
|
||||
|
||||
clean:
|
||||
git checkout debian scrapy/__init__.py
|
||||
git checkout debian scrapy/VERSION
|
||||
git clean -dfq
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import sys, os, glob, shutil
|
||||
from subprocess import check_call
|
||||
from scrapy import version_info
|
||||
|
||||
def build(suffix):
|
||||
for ifn in glob.glob("debian/scrapy.*"):
|
||||
|
|
@ -29,7 +30,7 @@ def clean(suffix):
|
|||
|
||||
def main():
|
||||
cmd = sys.argv[1]
|
||||
suffix = '%s.%s' % __import__('scrapy').version_info[:2]
|
||||
suffix = '%s.%s' % version_info[:2]
|
||||
if cmd == 'build':
|
||||
build(suffix)
|
||||
elif cmd == 'clean':
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
0.17.0
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
"""
|
||||
Scrapy - a screen scraping framework written in Python
|
||||
"""
|
||||
|
||||
version_info = (0, 17, 0)
|
||||
__version__ = "0.17.0"
|
||||
import pkgutil
|
||||
__version__ = pkgutil.get_data(__package__, 'VERSION').strip()
|
||||
version_info = tuple(__version__.split('.')[:3])
|
||||
|
||||
import sys, os, warnings
|
||||
|
||||
|
|
|
|||
8
setup.py
8
setup.py
|
|
@ -82,9 +82,11 @@ if os.name == 'nt':
|
|||
|
||||
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__ = '%s'" % v.strip())
|
||||
version = __import__('scrapy').__version__
|
||||
with open('scrapy/VERSION', 'w+') as f:
|
||||
f.write(v.strip())
|
||||
with open(os.path.join(os.path.dirname(__file__), 'scrapy/VERSION')) as f:
|
||||
version = f.read().strip()
|
||||
|
||||
|
||||
setup_args = {
|
||||
'name': 'Scrapy',
|
||||
|
|
|
|||
Loading…
Reference in New Issue