Prefix git suffixes with + instead of .

setuptools 8.0 enforces the accepted version of PEP440, which means
that 1.2.3.g123456 is now sorted before 1.0. Forget for a second that
under no obvious human inspection this makes sense, it is now the law of
the land and we must comply.

I swear to god I'm going to start coding in Go.

Change-Id: I2a5072d73e19ce77fa29ba5d8aa6e9649859a551
(cherry picked from commit fafd6c4db0)
This commit is contained in:
Monty Taylor 2014-12-13 12:24:41 -08:00 committed by Jeremy Stanley
parent ee94082d48
commit 1c89d18b6b
1 changed files with 3 additions and 2 deletions

View File

@ -809,10 +809,11 @@ def _get_version_from_git(pre_version):
except Exception:
sha = _run_git_command(
['log', '-n1', '--pretty=format:%h'], git_dir)
return "%s.dev%s.g%s" % (pre_version, _get_revno(git_dir), sha)
return "%s.dev%s+g%s" % (pre_version, _get_revno(git_dir), sha)
else:
return _run_git_command(
['describe', '--always'], git_dir).replace('-', '.')
['describe', '--always'],
git_dir).replace('-', '.').replace('.g', '+g')
# If we don't know the version, return an empty string so at least
# the downstream users of the value always have the same type of
# object to work with.