setup: use scm version

This commit is contained in:
Goffi 2018-04-05 12:49:25 +02:00
commit b5a4d8c58d

View file

@ -56,6 +56,24 @@ DBUS_DIR = 'dbus-1/services'
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 @@ setup(name=NAME,
],
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',