diff options
| -rw-r--r-- | mitmproxy/utils/debug.py | 16 | ||||
| -rwxr-xr-x | release/rtool.py | 4 | 
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 | 
