From 288952f96161c367e2b89fb1f9a788a66bd8bf0c Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 3 Nov 2020 01:32:54 -0800 Subject: [PATCH] Use VERSION.py instead of plain VERSION reduces reliance on package_data --- klamath/VERSION | 1 - klamath/VERSION.py | 4 ++++ klamath/__init__.py | 6 +----- setup.py | 8 +++----- 4 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 klamath/VERSION create mode 100644 klamath/VERSION.py diff --git a/klamath/VERSION b/klamath/VERSION deleted file mode 100644 index be58634..0000000 --- a/klamath/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.3 diff --git a/klamath/VERSION.py b/klamath/VERSION.py new file mode 100644 index 0000000..a53a2fa --- /dev/null +++ b/klamath/VERSION.py @@ -0,0 +1,4 @@ +""" VERSION defintion. THIS FILE IS MANUALLY PARSED BY setup.py and REQUIRES A SPECIFIC FORMAT """ +__version__ = ''' +0.3 +''' diff --git a/klamath/__init__.py b/klamath/__init__.py index 9f48837..7a8c54e 100644 --- a/klamath/__init__.py +++ b/klamath/__init__.py @@ -27,16 +27,12 @@ The goal is to keep this library simple: tools for working with hierarchical design data and supports multiple file formats. """ -import pathlib - from . import basic from . import record from . import records from . import elements from . import library +from .VERSION import __version__ __author__ = 'Jan Petykiewicz' - -with open(pathlib.Path(__file__).parent / 'VERSION', 'r') as f: - __version__ = f.read().strip() diff --git a/setup.py b/setup.py index b5d8b7d..72675e6 100644 --- a/setup.py +++ b/setup.py @@ -6,8 +6,8 @@ from setuptools import setup, find_packages with open('README.md', 'r') as f: long_description = f.read() -with open('klamath/VERSION', 'r') as f: - version = f.read().strip() +with open('klamath/VERSION.py', 'rt') as f: + version = f.readlines()[2].strip() setup(name='klamath', version=version, @@ -19,9 +19,7 @@ setup(name='klamath', url='https://mpxd.net/code/jan/klamath', packages=find_packages(), package_data={ - 'klamath': ['VERSION', - 'py.typed', - ] + 'klamath': ['py.typed'], }, install_requires=[ 'numpy',