Use fatamorgana/VERSION file to single-source version number

`import fatamorgana` inside setup.py could break if dependencies weren't
satisfied
This commit is contained in:
Jan Petykiewicz 2019-09-28 11:22:27 -07:00
parent 203a520770
commit e514ade2b1
4 changed files with 15 additions and 3 deletions

View File

@ -1,2 +1,3 @@
include README.md include README.md
include LICENSE.md include LICENSE.md
include fatamorgana/VERSION

1
fatamorgana/VERSION Normal file
View File

@ -0,0 +1 @@
0.4

View File

@ -18,6 +18,8 @@
- Python 3.5 or later - Python 3.5 or later
- numpy (optional, no additional functionality) - numpy (optional, no additional functionality)
""" """
import pathlib
from .main import OasisLayout, Cell, XName from .main import OasisLayout, Cell, XName
from .basic import NString, AString, Validation, OffsetTable, OffsetEntry, \ from .basic import NString, AString, Validation, OffsetTable, OffsetEntry, \
EOFError, SignedError, InvalidDataError, InvalidRecordError EOFError, SignedError, InvalidDataError, InvalidRecordError
@ -25,4 +27,7 @@ from .basic import NString, AString, Validation, OffsetTable, OffsetEntry, \
__author__ = 'Jan Petykiewicz' __author__ = 'Jan Petykiewicz'
version = '0.4' with open(pathlib.Path(__file__).parent / 'VERSION', 'r') as f:
__version__ = f.read().strip()
version = __version__

View File

@ -1,13 +1,15 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from setuptools import setup, find_packages from setuptools import setup, find_packages
import fatamorgana
with open('README.md', 'r') as f: with open('README.md', 'r') as f:
long_description = f.read() long_description = f.read()
with open('fatamorgana/VERSION', 'r') as f:
version = f.read().strip()
setup(name='fatamorgana', setup(name='fatamorgana',
version=fatamorgana.version, version=version,
description='OASIS layout format parser and writer', description='OASIS layout format parser and writer',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
@ -51,6 +53,9 @@ setup(name='fatamorgana',
'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Libraries :: Python Modules',
], ],
packages=find_packages(), packages=find_packages(),
package_data={
'fatamorgana': ['VERSION']
},
install_requires=[ install_requires=[
'typing', 'typing',
], ],