From b685d2a2f10d1602aa31ef114775167a1de2be06 Mon Sep 17 00:00:00 2001 From: Vinay Hegde Date: Tue, 17 Sep 2019 11:51:25 -0700 Subject: [PATCH 1/2] Single source the package version --- qmpy/__init__.py | 3 ++- setup.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qmpy/__init__.py b/qmpy/__init__.py index 15d4f96e..115bd5a1 100644 --- a/qmpy/__init__.py +++ b/qmpy/__init__.py @@ -18,7 +18,8 @@ import django.core.exceptions as de -__version__ = 'qmpy version = 1.3' +__version__ = '1.2.0' +VERSION = __version__ INSTALL_PATH = os.path.abspath(os.path.dirname(__file__)) sys.path = [os.path.join(INSTALL_PATH, 'qmpy', 'db')] + sys.path diff --git a/setup.py b/setup.py index e015809f..6caee604 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,11 @@ from setuptools import setup, find_packages +from qmpy import __version__ + + setup( name='qmpy', - version='1.2.0', + version=__version__, author='S. Kirklin', author_email='scott.kirklin@gmail.com', license='LICENSE.txt', From ba2d28329f7fd05b1b40b794d6b4160ba5afb85d Mon Sep 17 00:00:00 2001 From: Vinay Hegde Date: Tue, 17 Sep 2019 12:18:43 -0700 Subject: [PATCH 2/2] Single-source the package version - II - The previous `from qmpy import __version__` does not work as the `qmpy/__init__.py` file imports several packages that will not be available to `setup.py` (which is not really a good practice, but it is what we have) --- qmpy/VERSION.txt | 1 + qmpy/__init__.py | 6 +++++- setup.py | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 qmpy/VERSION.txt diff --git a/qmpy/VERSION.txt b/qmpy/VERSION.txt new file mode 100644 index 00000000..26aaba0e --- /dev/null +++ b/qmpy/VERSION.txt @@ -0,0 +1 @@ +1.2.0 diff --git a/qmpy/__init__.py b/qmpy/__init__.py index 115bd5a1..f272a984 100644 --- a/qmpy/__init__.py +++ b/qmpy/__init__.py @@ -18,8 +18,12 @@ import django.core.exceptions as de -__version__ = '1.2.0' + +with open(os.path.join(os.path.dirname(__file__), 'VERSION.txt')) as fr: + __version__ = fr.read().strip() VERSION = __version__ +__short_version__ = __version__.rpartition('.')[0] + INSTALL_PATH = os.path.abspath(os.path.dirname(__file__)) sys.path = [os.path.join(INSTALL_PATH, 'qmpy', 'db')] + sys.path diff --git a/setup.py b/setup.py index 6caee604..072dc1c2 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,12 @@ +import os from setuptools import setup, find_packages -from qmpy import __version__ - +with open(os.path.join(os.path.dirname(__file__), 'qmpy', 'VERSION.txt')) as fr: + version = fr.read().strip() setup( name='qmpy', - version=__version__, + version=version, author='S. Kirklin', author_email='scott.kirklin@gmail.com', license='LICENSE.txt',