Skip to content

Commit 7750fea

Browse files
author
Austin Bingham
committed
Moved version info into version.py.
Bumped version.
1 parent b63ebcd commit 7750fea

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

setup.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import io
2+
import os
13
from setuptools import setup, find_packages
24
import sys
35

@@ -9,9 +11,35 @@
911
if sys.version_info < (3, 4):
1012
install_requires.append('enum34')
1113

14+
15+
def local_file(*name):
16+
return os.path.join(
17+
os.path.dirname(__file__),
18+
*name)
19+
20+
21+
def read(name, **kwargs):
22+
with io.open(
23+
name,
24+
encoding=kwargs.get("encoding", "utf8")
25+
) as handle:
26+
return handle.read()
27+
28+
29+
# This is unfortunately duplicated from scripts/cosmic_ray_tooling.py. I
30+
# couldn't find a way to use the original version and still have tox
31+
# work...hmmm...
32+
def read_version(version_file):
33+
"Read the `(version-string, version-info)` from `version.py`."
34+
local_vars = {}
35+
with open(version_file) as handle:
36+
exec(handle.read(), {}, local_vars) # pylint: disable=exec-used
37+
return (local_vars['__version__'], local_vars['__version_info__'])
38+
39+
1240
setup(
1341
name='traad',
14-
version='3.0.1',
42+
version=read_version(local_file('traad', 'version.py'))[0],
1543
packages=find_packages(),
1644

1745
# metadata for upload to PyPI

traad/version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version_info__ = (3, 1, 0)
2+
__version__ = '.'.join(map(str, __version_info__))

0 commit comments

Comments
 (0)