# HG changeset patch # User Pierre-Yves David # Date 2023-01-30 17:41:59 # Node ID 8d390a13474d34c6fa8c05a1d385cd333be2b075 # Parent 84680c003d449ae4387f8be479a7a6ab3a05eb9b 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. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -337,8 +337,12 @@ if os.path.isdir('.hg'): 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')