changeset 49649:8d390a13474d stable

setup: make the version computation process more resistant The tag fetching might return and empty string?, from there everything derails quickly. As setup tools becomes more picky about version format we make the whole seems a bit more robust. The resulting version will be obviously weird, but at least it will actually install itself. [1] This is a problem we will address in the next changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 30 Jan 2023 18:41:59 +0100
parents 84680c003d44
children ac93876ea2df
files setup.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Mon Jan 30 18:25:11 2023 -0500
+++ b/setup.py	Mon Jan 30 18:41:59 2023 +0100
@@ -337,8 +337,12 @@
     else:  # no tag found
         ltagcmd = ['parents', '--template', '{latesttag}']
         ltag = sysstr(hg.run(ltagcmd))
+        if not ltag:
+            ltag = 'null'
         changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag]
         changessince = len(hg.run(changessincecmd).splitlines())
+        if ltag == 'null':
+            ltag = '0.0'
         version = '%s+hg%s.%s' % (ltag, changessince, hgid)
     if version.endswith('+'):
         version = version[:-1] + 'local' + time.strftime('%Y%m%d')