Change the way versioning is included in setup.py #127
Using regular expressions should work so long as the pattern in glymur/version.py does not change.
This commit is contained in:
parent
fe3964c212
commit
244fb26d96
2 changed files with 12 additions and 2 deletions
|
|
@ -13,6 +13,8 @@ from distutils.version import LooseVersion
|
|||
from .lib import openjpeg as opj
|
||||
from .lib import openjp2 as opj2
|
||||
|
||||
# Do not change the format of this next line! Doing so risks breaking
|
||||
# setup.py
|
||||
version = "0.5.4"
|
||||
_sv = LooseVersion(version)
|
||||
version_tuple = _sv.version
|
||||
|
|
|
|||
12
setup.py
12
setup.py
|
|
@ -1,4 +1,6 @@
|
|||
from setuptools import setup, find_packages
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
kwargs = {'name': 'Glymur',
|
||||
|
|
@ -12,8 +14,7 @@ kwargs = {'name': 'Glymur',
|
|||
'package_data': {'glymur': ['data/*.jp2', 'data/*.j2k']},
|
||||
'scripts': ['bin/jp2dump'],
|
||||
'license': 'MIT',
|
||||
'test_suite': 'glymur.test',
|
||||
'version': '0.5.4'}
|
||||
'test_suite': 'glymur.test'}
|
||||
|
||||
instllrqrs = ['numpy>=1.4.1']
|
||||
if sys.hexversion < 0x03030000:
|
||||
|
|
@ -39,4 +40,11 @@ clssfrs = ["Programming Language :: Python",
|
|||
"Topic :: Software Development :: Libraries :: Python Modules"]
|
||||
kwargs['classifiers'] = clssfrs
|
||||
|
||||
# Get the version string. Cannot do this by importing glymur!
|
||||
version_file = os.path.join('glymur', 'version.py')
|
||||
with open('glymur/version.py', 'rt') as fptr:
|
||||
contents = fptr.read()
|
||||
match = re.search('version\s*=\s*"(?P<version>\d*.\d*.\d*.*)"\n', contents)
|
||||
kwargs['version'] = match.group('version')
|
||||
|
||||
setup(**kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue