aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2017-01-23 22:53:02 +0100
committerGitHub <noreply@github.com>2017-01-23 22:53:02 +0100
commitacfd548fa239a6e36b8b0c5a197a5c6314494be6 (patch)
treed02269ac34d03a997ceb5163de73e956851abb52
parent2eaac31344da93fa8c8e2d245d81193aa65db346 (diff)
parent63beaa18ceeb0ac4a9d911b3072eb2eb07ac10c9 (diff)
downloadmitmproxy-acfd548fa239a6e36b8b0c5a197a5c6314494be6.tar.gz
mitmproxy-acfd548fa239a6e36b8b0c5a197a5c6314494be6.tar.bz2
mitmproxy-acfd548fa239a6e36b8b0c5a197a5c6314494be6.zip
Merge pull request #1956 from Kriechi/version-string
improve version specifiers
-rw-r--r--mitmproxy/utils/debug.py16
-rwxr-xr-xrelease/rtool.py4
2 files changed, 19 insertions, 1 deletions
diff --git a/mitmproxy/utils/debug.py b/mitmproxy/utils/debug.py
index 93fefa9d..52f48f6b 100644
--- a/mitmproxy/utils/debug.py
+++ b/mitmproxy/utils/debug.py
@@ -19,7 +19,21 @@ def dump_system_info():
try:
c = ['git', 'describe', '--tags', '--long']
git_describe = subprocess.check_output(c, stderr=subprocess.STDOUT)
- git_describe = git_describe.decode().strip()
+ last_tag, tag_dist, commit = git_describe.decode().strip().rsplit("-", 2)
+
+ if last_tag.startswith('v'):
+ # remove the 'v' prefix
+ last_tag = last_tag[1:]
+ if commit.startswith('g'):
+ # remove the 'g' prefix added by recent git versions
+ commit = commit[1:]
+
+ # build the same version specifier as used for snapshots by rtool
+ git_describe = "{version}dev{tag:04}-0x{commit}".format(
+ version=last_tag,
+ tag=int(tag_dist),
+ commit=commit,
+ )
except:
pass
diff --git a/release/rtool.py b/release/rtool.py
index 59899510..271392ba 100755
--- a/release/rtool.py
+++ b/release/rtool.py
@@ -89,6 +89,10 @@ def get_snapshot_version() -> str:
if tag_dist == 0:
return get_version()
else:
+ # remove the 'g' prefix added by recent git versions
+ if commit.startswith('g'):
+ commit = commit[1:]
+
# The wheel build tag (we use the commit) must start with a digit, so we include "0x"
return "{version}dev{tag_dist:04}-0x{commit}".format(
version=get_version(), # this should already be the next version