|
| 1 | + |
1 | 2 | # This file helps to compute a version number in source trees obtained from |
2 | 3 | # git-archive tarball (such as those provided by githubs download-from-tag |
3 | 4 | # feature). Distribution tarballs (built by setup.py sdist) and build |
4 | 5 | # directories (produced by setup.py build) will contain a much shorter file |
5 | 6 | # that just contains the computed version number. |
6 | 7 |
|
7 | 8 | # This file is released into the public domain. Generated by |
8 | | -# versioneer-0.18 (https://github.com/warner/python-versioneer) |
| 9 | +# versioneer-0.19 (https://github.com/python-versioneer/python-versioneer) |
9 | 10 |
|
10 | 11 | """Git implementation of _version.py.""" |
11 | 12 |
|
@@ -56,7 +57,7 @@ class NotThisMethod(Exception): |
56 | 57 |
|
57 | 58 |
|
58 | 59 | def register_vcs_handler(vcs, method): # decorator |
59 | | - """Decorator to mark a method as the handler for a particular VCS.""" |
| 60 | + """Create decorator to mark a method as the handler of a VCS.""" |
60 | 61 | def decorate(f): |
61 | 62 | """Store f in HANDLERS[vcs][method].""" |
62 | 63 | if vcs not in HANDLERS: |
@@ -92,9 +93,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, |
92 | 93 | if verbose: |
93 | 94 | print("unable to find command, tried %s" % (commands,)) |
94 | 95 | return None, None |
95 | | - stdout = p.communicate()[0].strip() |
96 | | - if sys.version_info[0] >= 3: |
97 | | - stdout = stdout.decode() |
| 96 | + stdout = p.communicate()[0].strip().decode() |
98 | 97 | if p.returncode != 0: |
99 | 98 | if verbose: |
100 | 99 | print("unable to run %s (error)" % dispcmd) |
@@ -164,6 +163,10 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): |
164 | 163 | raise NotThisMethod("no keywords at all, weird") |
165 | 164 | date = keywords.get("date") |
166 | 165 | if date is not None: |
| 166 | + # Use only the last line. Previous lines may contain GPG signature |
| 167 | + # information. |
| 168 | + date = date.splitlines()[-1] |
| 169 | + |
167 | 170 | # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant |
168 | 171 | # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 |
169 | 172 | # -like" string, which we must then edit to make compliant), because |
@@ -299,6 +302,9 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): |
299 | 302 | # commit date: see ISO-8601 comment in git_versions_from_keywords() |
300 | 303 | date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], |
301 | 304 | cwd=root)[0].strip() |
| 305 | + # Use only the last line. Previous lines may contain GPG signature |
| 306 | + # information. |
| 307 | + date = date.splitlines()[-1] |
302 | 308 | pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) |
303 | 309 |
|
304 | 310 | return pieces |
@@ -337,18 +343,18 @@ def render_pep440(pieces): |
337 | 343 |
|
338 | 344 |
|
339 | 345 | def render_pep440_pre(pieces): |
340 | | - """TAG[.post.devDISTANCE] -- No -dirty. |
| 346 | + """TAG[.post0.devDISTANCE] -- No -dirty. |
341 | 347 |
|
342 | 348 | Exceptions: |
343 | | - 1: no tags. 0.post.devDISTANCE |
| 349 | + 1: no tags. 0.post0.devDISTANCE |
344 | 350 | """ |
345 | 351 | if pieces["closest-tag"]: |
346 | 352 | rendered = pieces["closest-tag"] |
347 | 353 | if pieces["distance"]: |
348 | | - rendered += ".post.dev%d" % pieces["distance"] |
| 354 | + rendered += ".post0.dev%d" % pieces["distance"] |
349 | 355 | else: |
350 | 356 | # exception #1 |
351 | | - rendered = "0.post.dev%d" % pieces["distance"] |
| 357 | + rendered = "0.post0.dev%d" % pieces["distance"] |
352 | 358 | return rendered |
353 | 359 |
|
354 | 360 |
|
@@ -494,7 +500,7 @@ def get_versions(): |
494 | 500 | # versionfile_source is the relative path from the top of the source |
495 | 501 | # tree (where the .git directory might live) to this file. Invert |
496 | 502 | # this to find the root from __file__. |
497 | | - for i in cfg.versionfile_source.split('/'): # lgtm[py/unused-loop-variable] |
| 503 | + for i in cfg.versionfile_source.split('/'): |
498 | 504 | root = os.path.dirname(root) |
499 | 505 | except NameError: |
500 | 506 | return {"version": "0+unknown", "full-revisionid": None, |
|
0 commit comments