Skip to content

Commit a1a55ff

Browse files
authored
Merge pull request #967 from effigies/mnt/upgrade_versioneer
MNT: Upgrade versioneer to 0.19
2 parents cbc4397 + 3fbd7c9 commit a1a55ff

File tree

2 files changed

+113
-71
lines changed

2 files changed

+113
-71
lines changed

nibabel/_version.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# that just contains the computed version number.
77

88
# This file is released into the public domain. Generated by
9-
# versioneer-0.18 (https://github.com/warner/python-versioneer)
9+
# versioneer-0.19 (https://github.com/python-versioneer/python-versioneer)
1010

1111
"""Git implementation of _version.py."""
1212

@@ -58,7 +58,7 @@ class NotThisMethod(Exception):
5858

5959

6060
def register_vcs_handler(vcs, method): # decorator
61-
"""Decorator to mark a method as the handler for a particular VCS."""
61+
"""Create decorator to mark a method as the handler of a VCS."""
6262
def decorate(f):
6363
"""Store f in HANDLERS[vcs][method]."""
6464
if vcs not in HANDLERS:
@@ -94,9 +94,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
9494
if verbose:
9595
print("unable to find command, tried %s" % (commands,))
9696
return None, None
97-
stdout = p.communicate()[0].strip()
98-
if sys.version_info[0] >= 3:
99-
stdout = stdout.decode()
97+
stdout = p.communicate()[0].strip().decode()
10098
if p.returncode != 0:
10199
if verbose:
102100
print("unable to run %s (error)" % dispcmd)
@@ -174,6 +172,10 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
174172
raise NotThisMethod("Short version file found")
175173
date = keywords.get("date")
176174
if date is not None:
175+
# Use only the last line. Previous lines may contain GPG signature
176+
# information.
177+
date = date.splitlines()[-1]
178+
177179
# git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
178180
# datestamp. However we prefer "%ci" (which expands to an "ISO-8601
179181
# -like" string, which we must then edit to make compliant), because
@@ -314,6 +316,9 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
314316
# commit date: see ISO-8601 comment in git_versions_from_keywords()
315317
date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"],
316318
cwd=root)[0].strip()
319+
# Use only the last line. Previous lines may contain GPG signature
320+
# information.
321+
date = date.splitlines()[-1]
317322
pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
318323

319324
return pieces
@@ -352,18 +357,18 @@ def render_pep440(pieces):
352357

353358

354359
def render_pep440_pre(pieces):
355-
"""TAG[.post.devDISTANCE] -- No -dirty.
360+
"""TAG[.post0.devDISTANCE] -- No -dirty.
356361
357362
Exceptions:
358-
1: no tags. 0.post.devDISTANCE
363+
1: no tags. 0.post0.devDISTANCE
359364
"""
360365
if pieces["closest-tag"]:
361366
rendered = pieces["closest-tag"]
362367
if pieces["distance"]:
363-
rendered += ".post.dev%d" % pieces["distance"]
368+
rendered += ".post0.dev%d" % pieces["distance"]
364369
else:
365370
# exception #1
366-
rendered = "0.post.dev%d" % pieces["distance"]
371+
rendered = "0.post0.dev%d" % pieces["distance"]
367372
return rendered
368373

369374

@@ -399,7 +404,7 @@ def render_pep440_old(pieces):
399404
400405
The ".dev0" means dirty.
401406
402-
Eexceptions:
407+
Exceptions:
403408
1: no tags. 0.postDISTANCE[.dev0]
404409
"""
405410
if pieces["closest-tag"]:

0 commit comments

Comments
 (0)