Skip to content

Commit cec2f09

Browse files
committed
moved from VERSION data file to version.py (Marco-Sulla#64)
1 parent de2d7b9 commit cec2f09

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

frozendict/VERSION

-1
This file was deleted.

frozendict/__init__.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from .core import *
99
c_ext = False
1010

11+
from .version import version as __version__
1112
import collections.abc as _abc
1213

1314
if not c_ext:
@@ -24,14 +25,8 @@ def _my_subclasshook(klass, subclass):
2425

2526
from pathlib import Path
2627

27-
version_filename = "VERSION"
28-
2928
curr_path = Path(__file__)
3029
curr_dir = curr_path.parent
31-
version_path = curr_dir / version_filename
32-
33-
with open(version_path) as f:
34-
__version__ = f.read()
3530

3631
if c_ext:
3732
__all__ = ("frozendict", "__version__", )
@@ -43,11 +38,8 @@ def _my_subclasshook(klass, subclass):
4338
__all__ += ("FrozenOrderedDict", )
4439

4540
del Path
46-
del version_filename
4741
del curr_path
4842
del curr_dir
49-
del version_path
50-
del f
5143
del _abc
5244

5345
if not c_ext:

frozendict/version.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version = "2.3.4"

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
main_package_name = "frozendict"
1010
test_dir_name = "test"
1111
readme_filename = "README.md"
12-
version_filename = "VERSION"
12+
version_filename = "version.py"
1313
py_typed_filename = "py.typed"
1414
mypy_filename = "frozendict.pyi"
1515
main_url = "https://github.com/Marco-Sulla/python-frozendict"
@@ -48,11 +48,11 @@
4848

4949
main_package_path = curr_dir / main_package_name
5050

51-
version = ""
5251
version_path = main_package_path / version_filename
5352

5453
with open(version_path) as f:
55-
version = f.read()
54+
# create the version var
55+
exec(f.read())
5656

5757
excluded_packages = (test_dir_name, )
5858
packages = setuptools.find_packages(exclude=excluded_packages)

0 commit comments

Comments
 (0)