# HG changeset patch # User Goffi # Date 1522925365 -7200 # Node ID 7e7f4e344a963f81c3139f315284a7111653eace # Parent 4aca060075b7c28c6fccbffbf885f8e27f2ceb07 setup: use scm version diff -r 4aca060075b7 -r 7e7f4e344a96 setup.py --- a/setup.py Thu Apr 05 10:41:08 2018 +0200 +++ b/setup.py Thu Apr 05 12:49:25 2018 +0200 @@ -56,6 +56,24 @@ DBUS_FILE = 'misc/org.goffi.SAT.service' with open('sat/VERSION') as f: VERSION = f.read().strip() +is_dev_version = VERSION.endswith('D') + + +def sat_dev_version(): + """Use mercurial data to compute version""" + def version_scheme(version): + return VERSION + + def local_scheme(version): + # XXX: setuptools_scm seems buggy and the '+' and the '_' are replaced by '-' + # breaking the local version identifier scheme + # cf. https://github.com/pypa/setuptools_scm/issues/237 + return "+{rev}_{distance}".format( + rev=version.node[1:], + distance=version.distance) + + return {'version_scheme': version_scheme, + 'local_scheme': local_scheme} setup(name=NAME, @@ -78,6 +96,8 @@ ], scripts=['sat_frontends/jp/jp', 'sat_frontends/primitivus/primitivus', 'bin/sat'], zip_safe=False, + setup_requires=['setuptools_scm'] if is_dev_version else [], + use_scm_version=sat_dev_version if is_dev_version else False, install_requires=install_requires, package_data={'sat': ['VERSION']}, python_requires='~=2.7',