diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2017-01-26 16:20:31 +0100 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2017-01-26 16:20:31 +0100 |
commit | 26953a6c0a969d9596b55f4b77fe92aa79a5ba38 (patch) | |
tree | ea3c692b372db28007fc3f0ec8d061348ef26338 /setup.py | |
parent | 9cf20094857f4568ef0218ae132913d1a08ed35d (diff) | |
download | setuptools-scm-26953a6c0a969d9596b55f4b77fe92aa79a5ba38.tar.gz |
ensure we find our own version in a sdist
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -24,6 +24,19 @@ if not os.path.isdir('setuptools_scm.egg-info'): sys.exit('please run `python setup.py egg_info` first') +def _find_hackish_version(): + here = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, here) + from setuptools_scm.hacks import parse_pkginfo + from setuptools_scm import get_version + try: + return get_version( + root=here, parse=parse_pkginfo, + **scm_config()) + except IOError: + pass + + def scm_config(): from setuptools_scm.version import ( guess_next_dev_version, @@ -37,13 +50,15 @@ def scm_config(): with open('README.rst') as fp: long_description = fp.read() +found_version = _find_hackish_version() arguments = dict( name='setuptools_scm', url='https://github.com/pypa/setuptools_scm/', zip_safe=True, + version=found_version, # pass here since entrypints are not yet registred - use_scm_version=scm_config, + use_scm_version=found_version is None and scm_config, author='Ronny Pfannschmidt', author_email='opensource@ronnypfannschmidt.de', description=('the blessed package to manage your versions by scm tags'), |