diff --git a/.gitignore b/.gitignore index f83ff17..e36962b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ tests/storage/dav/servers/* !tests/storage/dav/servers/__init__.py !tests/storage/dav/servers/radicale docs/_build/ +vdirsyncer/version.py diff --git a/setup.py b/setup.py index 1236d9a..8bb62c4 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,9 @@ from setuptools import find_packages, setup setup( name='vdirsyncer', - use_scm_version=True, + use_scm_version={ + 'write_to': 'vdirsyncer/version.py', + }, setup_requires=['setuptools_scm'], author='Markus Unterwaditzer', author_email='markus@unterwaditzer.net', diff --git a/vdirsyncer/__init__.py b/vdirsyncer/__init__.py index bd1b9be..15a8ede 100644 --- a/vdirsyncer/__init__.py +++ b/vdirsyncer/__init__.py @@ -4,7 +4,15 @@ vdirsyncer is a synchronization tool for vdir. See the README for more details. ''' import pkg_resources -__version__ = pkg_resources.get_distribution('vdirsyncer').version + +try: + from .version import version as __version__ +except ImportError: + raise ImportError( + 'Failed to find (autogenerated) version.py. ' + 'This might be because you are installing from GitHub\'s tarballs, ' + 'use the PyPI ones.' + ) PROJECT_HOME = 'https://github.com/untitaker/vdirsyncer' DOCS_HOME = 'https://vdirsyncer.readthedocs.org/en/latest'