diff --git a/.gitignore b/.gitignore index ecb357f..80c5885 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ dist *~ *.so .tox/ +# autogenerated from git tag by setuptools_scm +src/zopfli/_version.py diff --git a/setup.py b/setup.py index a75c94a..da55837 100755 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ def build_extensions(self): setup( name='zopfli', - version='0.1.8', + use_scm_version={"write_to": "src/zopfli/_version.py"}, author='Adam DePrince', author_email='deprince@googlealumni.com', maintainer='Cosimo Lupo', @@ -87,4 +87,5 @@ def build_extensions(self): cmdclass={ "build_ext": custom_build_ext, }, + setup_requires=["setuptools_scm"], ) diff --git a/src/zopfli/__init__.py b/src/zopfli/__init__.py index 76e5050..2d0f843 100644 --- a/src/zopfli/__init__.py +++ b/src/zopfli/__init__.py @@ -24,3 +24,8 @@ unlimited, but this can give extreme results that hurt compression on some files). Default value: 15. """ + +try: + from ._version import version as __version__ # type: ignore +except ImportError: + __version__ = "0.0.0+unknown"