Skip to content

Commit 8ed9b1e

Browse files
committed
Move to versioneer
1 parent 91184d9 commit 8ed9b1e

7 files changed

+2706
-12
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tobler/_version.py export-subst

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
include MANIFEST.in LICENSE.txt requirements_docs.txt requirements_tests.txt requirements.txt
2+
include versioneer.py
3+
include tobler/_version.py

setup.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[versioneer]
2+
VCS = git
3+
style = pep440
4+
versionfile_source = tobler/_version.py
5+
versionfile_build = tobler/_version.py
6+
tag_prefix = v
7+
parentdir_prefix = tobler-

setup.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
33
Tobler is a Python library for areal interpolation.
44
"""
5+
import os
6+
import versioneer
7+
from setuptools import setup, find_packages
8+
from distutils.command.build_py import build_py
59

610

711
DOCLINES = __doc__.split("\n")
@@ -10,15 +14,6 @@
1014
long_description = file.read()
1115

1216

13-
from setuptools import setup, find_packages
14-
from distutils.command.build_py import build_py
15-
import os
16-
17-
# Get __version__ from tobler/__init__.py without importing the package
18-
# __version__ has to be defined in the first line
19-
with open("tobler/__init__.py", "r") as f:
20-
exec(f.readline())
21-
2217
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
2318
# update it when the contents of directories change.
2419
if os.path.exists("MANIFEST"):
@@ -49,7 +44,8 @@ def setup_package():
4944

5045
setup(
5146
name="tobler", # name of package
52-
version=__version__,
47+
version=versioneer.get_version(),
48+
cmdclass=versioneer.get_cmdclass({"build_py": build_py}),
5349
description=DOCLINES[0],
5450
# long_description="\n".join(DOCLINES[2:]),
5551
long_description=long_description,
@@ -78,7 +74,6 @@ def setup_package():
7874
install_requires=install_reqs,
7975
extras_require=extras_reqs,
8076
zip_safe=False,
81-
cmdclass={"build.py": build_py},
8277
)
8378

8479

tobler/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
__version__ = "0.8.2"
21
"""
32
:mod:`tobler` --- A library for spatial interpolation
43
=================================================
@@ -9,3 +8,6 @@
98
from . import model
109
from . import util
1110
from . import pycno
11+
12+
from . import _version
13+
__version__ = _version.get_versions()['version']

0 commit comments

Comments
 (0)