From 26953a6c0a969d9596b55f4b77fe92aa79a5ba38 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Thu, 26 Jan 2017 16:20:31 +0100 Subject: ensure we find our own version in a sdist --- setup.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index cd0160a..76e0d00 100644 --- a/setup.py +++ b/setup.py @@ -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'), -- cgit v1.2.1