Skip to content

Commit 647c2cc

Browse files
authored
Merge pull request #4 from JonathanArns/version-file
separate version into it's own module
2 parents acc5d2b + 33b5069 commit 647c2cc

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
import os
33
from setuptools import setup, find_packages
44

5-
VERSION = '0.2.0'
5+
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
6+
7+
version = {}
8+
with io.open(os.path.join(PROJECT_ROOT, "src", "dirhash", "version.py")) as fp:
9+
exec(fp.read(), version)
610

711
DESCRIPTION = 'Python module and CLI for hashing of file system directories.'
812

9-
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
1013
try:
1114
with io.open(os.path.join(PROJECT_ROOT, 'README.md'), encoding='utf-8') as f:
1215
long_description = '\n' + f.read()
@@ -15,7 +18,7 @@
1518

1619
setup(
1720
name='dirhash',
18-
version=VERSION,
21+
version=version['__version__'],
1922
description=DESCRIPTION,
2023
long_description=long_description,
2124
long_description_content_type="text/markdown",

src/dirhash/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
CyclicLinkedDir,
1717
)
1818

19+
from dirhash.version import __version__
20+
1921
__all__ = [
2022
'__version__',
2123
'algorithms_guaranteed',
@@ -28,7 +30,6 @@
2830
'Protocol'
2931
]
3032

31-
__version__ = pkg_resources.require("dirhash")[0].version
3233

3334
algorithms_guaranteed = {'md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'}
3435
algorithms_available = hashlib.algorithms_available

src/dirhash/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.2.0'

0 commit comments

Comments
 (0)