Skip to content

Commit

Permalink
Single-source the package version - II
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
hegdevinayi committed Sep 17, 2019
1 parent b685d2a commit ba2d283
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions qmpy/VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.0
6 changes: 5 additions & 1 deletion qmpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[email protected]',
license='LICENSE.txt',
Expand Down

0 comments on commit ba2d283

Please sign in to comment.