diff --git a/enumfields/__init__.py b/enumfields/__init__.py index 35a023e..dfff927 100644 --- a/enumfields/__init__.py +++ b/enumfields/__init__.py @@ -1,2 +1,4 @@ from .enums import Enum, IntEnum from .fields import EnumField, EnumIntegerField + +__version__ = "1.0.0" diff --git a/setup.py b/setup.py index 9894dd7..fe6e639 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os +import re from setuptools import find_packages, setup @@ -9,17 +10,19 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() -README = read('README.rst') +def read_version(fname): + return re.search("__version__ = ['\"]([^'\"]+)['\"]", read(fname)).group(1) + setup( name='django-enumfields', - version='1.0.0', + version=read_version('enumfields/__init__.py'), author='HZDG', author_email='webmaster@hzdg.com', description='Real Python Enums for Django.', license='MIT', url='https://github.com/hzdg/django-enumfields', - long_description=README, + long_description=(read('README.rst')), packages=find_packages(exclude=['tests*']), zip_safe=False, classifiers=[ diff --git a/tests/test_misc.py b/tests/test_misc.py new file mode 100644 index 0000000..37aa75c --- /dev/null +++ b/tests/test_misc.py @@ -0,0 +1,5 @@ +import enumfields + + +def test_version(): + assert isinstance(enumfields.__version__, str)