diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-01-23 20:22:19 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-01-23 20:33:12 +0100 |
commit | 63beaa18ceeb0ac4a9d911b3072eb2eb07ac10c9 (patch) | |
tree | abd268360ddea55ff6311dc7b1ca9b0d14ca4122 /mitmproxy | |
parent | 86174eb6adfb83de6ba4dfbcff73ee9cb18ac4aa (diff) | |
download | mitmproxy-63beaa18ceeb0ac4a9d911b3072eb2eb07ac10c9.tar.gz mitmproxy-63beaa18ceeb0ac4a9d911b3072eb2eb07ac10c9.tar.bz2 mitmproxy-63beaa18ceeb0ac4a9d911b3072eb2eb07ac10c9.zip |
improve version specifiers
Diffstat (limited to 'mitmproxy')
-rw-r--r-- | mitmproxy/utils/debug.py | 16 |
1 files changed, 15 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 |