Skip to content

Commit 7e8f6c4

Browse files
authored
MAINT: Update versioneer (#18)
* Update versioneer * Versioneer 0.27 doesn't support py3.6
1 parent 73bf51d commit 7e8f6c4

File tree

4 files changed

+229
-127
lines changed

4 files changed

+229
-127
lines changed

.github/workflows/sdist.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
python-version:
24-
- "3.6"
2524
- "3.7"
2625
- "3.8"
2726
- "3.9"

flowlauncher/_version.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# directories (produced by setup.py build) will contain a much shorter file
66
# that just contains the computed version number.
77

8-
# This file is released into the public domain. Generated by
9-
# versioneer-0.21 (https://github.com/python-versioneer/python-versioneer)
8+
# This file is released into the public domain.
9+
# Generated by versioneer-0.27
10+
# https://github.com/python-versioneer/python-versioneer
1011

1112
"""Git implementation of _version.py."""
1213

@@ -16,6 +17,7 @@
1617
import subprocess
1718
import sys
1819
from typing import Callable, Dict
20+
import functools
1921

2022

2123
def get_keywords():
@@ -73,14 +75,22 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
7375
"""Call the given command(s)."""
7476
assert isinstance(commands, list)
7577
process = None
78+
79+
popen_kwargs = {}
80+
if sys.platform == "win32":
81+
# This hides the console window if pythonw.exe is used
82+
startupinfo = subprocess.STARTUPINFO()
83+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
84+
popen_kwargs["startupinfo"] = startupinfo
85+
7686
for command in commands:
7787
try:
7888
dispcmd = str([command] + args)
7989
# remember shell=False, so use git.cmd on windows, not just git
8090
process = subprocess.Popen([command] + args, cwd=cwd, env=env,
8191
stdout=subprocess.PIPE,
8292
stderr=(subprocess.PIPE if hide_stderr
83-
else None))
93+
else None), **popen_kwargs)
8494
break
8595
except OSError:
8696
e = sys.exc_info()[1]
@@ -228,25 +238,29 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
228238
version string, meaning we're inside a checked out source tree.
229239
"""
230240
GITS = ["git"]
231-
TAG_PREFIX_REGEX = "*"
232241
if sys.platform == "win32":
233242
GITS = ["git.cmd", "git.exe"]
234-
TAG_PREFIX_REGEX = r"\*"
243+
244+
# GIT_DIR can interfere with correct operation of Versioneer.
245+
# It may be intended to be passed to the Versioneer-versioned project,
246+
# but that should not change where we get our version from.
247+
env = os.environ.copy()
248+
env.pop("GIT_DIR", None)
249+
runner = functools.partial(runner, env=env)
235250

236251
_, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
237-
hide_stderr=True)
252+
hide_stderr=not verbose)
238253
if rc != 0:
239254
if verbose:
240255
print("Directory %s not under git control" % root)
241256
raise NotThisMethod("'git rev-parse --git-dir' returned error")
242257

243258
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
244259
# if there isn't one, this yields HEX[-dirty] (no NUM)
245-
describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
246-
"--always", "--long",
247-
"--match",
248-
"%s%s" % (tag_prefix, TAG_PREFIX_REGEX)],
249-
cwd=root)
260+
describe_out, rc = runner(GITS, [
261+
"describe", "--tags", "--dirty", "--always", "--long",
262+
"--match", f"{tag_prefix}[[:digit:]]*"
263+
], cwd=root)
250264
# --long was added in git-1.5.5
251265
if describe_out is None:
252266
raise NotThisMethod("'git describe' failed")
@@ -335,8 +349,8 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
335349
else:
336350
# HEX: no tags
337351
pieces["closest-tag"] = None
338-
count_out, rc = runner(GITS, ["rev-list", "HEAD", "--count"], cwd=root)
339-
pieces["distance"] = int(count_out) # total number of commits
352+
out, rc = runner(GITS, ["rev-list", "HEAD", "--left-right"], cwd=root)
353+
pieces["distance"] = len(out.split()) # total number of commits
340354

341355
# commit date: see ISO-8601 comment in git_versions_from_keywords()
342356
date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip()
@@ -432,7 +446,7 @@ def render_pep440_pre(pieces):
432446
tag_version, post_version = pep440_split_post(pieces["closest-tag"])
433447
rendered = tag_version
434448
if post_version is not None:
435-
rendered += ".post%d.dev%d" % (post_version+1, pieces["distance"])
449+
rendered += ".post%d.dev%d" % (post_version + 1, pieces["distance"])
436450
else:
437451
rendered += ".post0.dev%d" % (pieces["distance"])
438452
else:

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"Programming Language :: Python",
3737
"Programming Language :: Python :: 3",
3838
"Programming Language :: Python :: 3 :: Only",
39-
"Programming Language :: Python :: 3.6",
4039
"Programming Language :: Python :: 3.7",
4140
"Programming Language :: Python :: 3.8",
4241
"Programming Language :: Python :: 3.9",

0 commit comments

Comments
 (0)