Mercurial > libervia-backend
changeset 2576:cb7bf936d8e8
setup, tools(utils): fixed versioning in setup and getRepositoryData
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Apr 2018 16:47:40 +0200 |
parents | 824ef7f64286 |
children | 1209a5d83082 |
files | sat/tools/utils.py setup.py |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/tools/utils.py Fri Apr 06 15:41:26 2018 +0200 +++ b/sat/tools/utils.py Fri Apr 06 16:47:40 2018 +0200 @@ -204,18 +204,23 @@ try: import pkg_resources pkg_version = pkg_resources.get_distribution(C.APP_NAME_FILE).version - version, hg_node, hg_distance = pkg_version.split('-') + version, local_id = pkg_version.split('+', 1) except ImportError: log.warning("pkg_resources not available, can't get package data") except pkg_resources.DistributionNotFound: log.warning("can't retrieve package data") except ValueError: - log.warning(u"package version doesn't fit: {pkg_version}".format(pkg_version=pkg_version)) + log.info(u"no local version id in package: {pkg_version}".format(pkg_version=pkg_version)) else: + version = version.replace('.dev0', 'D') if version != C.APP_VERSION: - log.error("Incompatible version ({version}) and pkg_version ({pkg_version})".format( + log.warning("Incompatible version ({version}) and pkg_version ({pkg_version})".format( version=C.APP_VERSION, pkg_version=pkg_version)) else: + try: + hg_node, hg_distance = local_id.split('.') + except ValueError: + log.warning("Version doesn't specify repository data") hg_data = {'node_short': hg_node, 'distance': hg_distance} repos_cache_dict = hg_data
--- a/setup.py Fri Apr 06 15:41:26 2018 +0200 +++ b/setup.py Fri Apr 06 16:47:40 2018 +0200 @@ -62,13 +62,10 @@ def sat_dev_version(): """Use mercurial data to compute version""" def version_scheme(version): - return VERSION + return VERSION.replace('D', '.dev0') 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( + return "+{rev}.{distance}".format( rev=version.node[1:], distance=version.distance)