Skip to content

Commit

Permalink
Merge pull request #29 from sameeul/versioneer_fix
Browse files Browse the repository at this point in the history
update versioneer
  • Loading branch information
hsidky authored May 26, 2022
2 parents b0966ec + 25b49e5 commit 99aaecc
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 29 deletions.
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Nyxus",
"version": "0.2.2",
"containerId": "polusai/nyxus:0.2.2",
"version": "0.2.3",
"containerId": "polusai/nyxus:0.2.3",
"title": "Nyxus feature extraction",
"description": "Nyxus feature extractor",
"author": "friskluft + hsidky",
Expand Down
30 changes: 22 additions & 8 deletions src/nyx/python/nyxus/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# that just contains the computed version number.

# This file is released into the public domain. Generated by
# versioneer-0.21 (https://github.com/python-versioneer/python-versioneer)
# versioneer-0.22 (https://github.com/python-versioneer/python-versioneer)

"""Git implementation of _version.py."""

Expand All @@ -16,6 +16,7 @@
import subprocess
import sys
from typing import Callable, Dict
import functools


def get_keywords():
Expand All @@ -41,7 +42,7 @@ def get_config():
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.style = "pep440-pre"
cfg.tag_prefix = ""
cfg.parentdir_prefix = "None"
cfg.versionfile_source = "src/nyx/python/nyxus/_version.py"
Expand Down Expand Up @@ -73,14 +74,22 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
"""Call the given command(s)."""
assert isinstance(commands, list)
process = None

popen_kwargs = {}
if sys.platform == "win32":
# This hides the console window if pythonw.exe is used
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
popen_kwargs["startupinfo"] = startupinfo

for command in commands:
try:
dispcmd = str([command] + args)
# remember shell=False, so use git.cmd on windows, not just git
process = subprocess.Popen([command] + args, cwd=cwd, env=env,
stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
else None), **popen_kwargs)
break
except OSError:
e = sys.exc_info()[1]
Expand Down Expand Up @@ -228,10 +237,15 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
version string, meaning we're inside a checked out source tree.
"""
GITS = ["git"]
TAG_PREFIX_REGEX = "*"
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
TAG_PREFIX_REGEX = r"\*"

# GIT_DIR can interfere with correct operation of Versioneer.
# It may be intended to be passed to the Versioneer-versioned project,
# but that should not change where we get our version from.
env = os.environ.copy()
env.pop("GIT_DIR", None)
runner = functools.partial(runner, env=env)

_, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
hide_stderr=True)
Expand All @@ -240,12 +254,12 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
print("Directory %s not under git control" % root)
raise NotThisMethod("'git rev-parse --git-dir' returned error")

MATCH_ARGS = ["--match", "%s*" % tag_prefix] if tag_prefix else []

# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
"--always", "--long",
"--match",
"%s%s" % (tag_prefix, TAG_PREFIX_REGEX)],
"--always", "--long", *MATCH_ARGS],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
Expand Down
2 changes: 1 addition & 1 deletion src/nyx/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#define VERSIONH_INCLUDED

#define PROJECT_NAME "Nyxus"
#define PROJECT_VER "0.2.2"
#define PROJECT_VER "0.2.3"

#endif // VERSIONH_INCLUDED
67 changes: 49 additions & 18 deletions versioneer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Version: 0.21
# Version: 0.22

"""The Versioneer - like a rocketeer, but for versions.
Expand All @@ -10,11 +10,11 @@
* https://github.com/python-versioneer/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible with: Python 3.6, 3.7, 3.8, 3.9 and pypy3
* Compatible with: Python 3.6, 3.7, 3.8, 3.9, 3.10 and pypy3
* [![Latest Version][pypi-image]][pypi-url]
* [![Build Status][travis-image]][travis-url]
This is a tool for managing a recorded version number in distutils-based
This is a tool for managing a recorded version number in distutils/setuptools-based
python projects. The goal is to remove the tedious and error-prone "update
the embedded version string" step from your release process. Making a new
release should be as easy as recording a new tag in your version-control
Expand Down Expand Up @@ -288,6 +288,7 @@
import subprocess
import sys
from typing import Callable, Dict
import functools


class VersioneerConfig:
Expand Down Expand Up @@ -384,14 +385,22 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
"""Call the given command(s)."""
assert isinstance(commands, list)
process = None

popen_kwargs = {}
if sys.platform == "win32":
# This hides the console window if pythonw.exe is used
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
popen_kwargs["startupinfo"] = startupinfo

for command in commands:
try:
dispcmd = str([command] + args)
# remember shell=False, so use git.cmd on windows, not just git
process = subprocess.Popen([command] + args, cwd=cwd, env=env,
stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
else None), **popen_kwargs)
break
except OSError:
e = sys.exc_info()[1]
Expand Down Expand Up @@ -422,7 +431,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
# that just contains the computed version number.
# This file is released into the public domain. Generated by
# versioneer-0.21 (https://github.com/python-versioneer/python-versioneer)
# versioneer-0.22 (https://github.com/python-versioneer/python-versioneer)
"""Git implementation of _version.py."""
Expand All @@ -432,6 +441,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
import subprocess
import sys
from typing import Callable, Dict
import functools
def get_keywords():
Expand Down Expand Up @@ -489,14 +499,22 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
"""Call the given command(s)."""
assert isinstance(commands, list)
process = None
popen_kwargs = {}
if sys.platform == "win32":
# This hides the console window if pythonw.exe is used
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
popen_kwargs["startupinfo"] = startupinfo
for command in commands:
try:
dispcmd = str([command] + args)
# remember shell=False, so use git.cmd on windows, not just git
process = subprocess.Popen([command] + args, cwd=cwd, env=env,
stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
else None), **popen_kwargs)
break
except OSError:
e = sys.exc_info()[1]
Expand Down Expand Up @@ -644,10 +662,15 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
version string, meaning we're inside a checked out source tree.
"""
GITS = ["git"]
TAG_PREFIX_REGEX = "*"
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
TAG_PREFIX_REGEX = r"\*"
# GIT_DIR can interfere with correct operation of Versioneer.
# It may be intended to be passed to the Versioneer-versioned project,
# but that should not change where we get our version from.
env = os.environ.copy()
env.pop("GIT_DIR", None)
runner = functools.partial(runner, env=env)
_, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
hide_stderr=True)
Expand All @@ -656,12 +679,12 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
print("Directory %%s not under git control" %% root)
raise NotThisMethod("'git rev-parse --git-dir' returned error")
MATCH_ARGS = ["--match", "%%s*" %% tag_prefix] if tag_prefix else []
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
"--always", "--long",
"--match",
"%%s%%s" %% (tag_prefix, TAG_PREFIX_REGEX)],
"--always", "--long", *MATCH_ARGS],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
Expand Down Expand Up @@ -1162,10 +1185,15 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
version string, meaning we're inside a checked out source tree.
"""
GITS = ["git"]
TAG_PREFIX_REGEX = "*"
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
TAG_PREFIX_REGEX = r"\*"

# GIT_DIR can interfere with correct operation of Versioneer.
# It may be intended to be passed to the Versioneer-versioned project,
# but that should not change where we get our version from.
env = os.environ.copy()
env.pop("GIT_DIR", None)
runner = functools.partial(runner, env=env)

_, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
hide_stderr=True)
Expand All @@ -1174,12 +1202,12 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
print("Directory %s not under git control" % root)
raise NotThisMethod("'git rev-parse --git-dir' returned error")

MATCH_ARGS = ["--match", "%s*" % tag_prefix] if tag_prefix else []

# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
"--always", "--long",
"--match",
"%s%s" % (tag_prefix, TAG_PREFIX_REGEX)],
"--always", "--long", *MATCH_ARGS],
cwd=root)
# --long was added in git-1.5.5
if describe_out is None:
Expand Down Expand Up @@ -1344,7 +1372,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):


SHORT_VERSION_PY = """
# This file was generated by 'versioneer.py' (0.21) from
# This file was generated by 'versioneer.py' (0.22) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
Expand Down Expand Up @@ -1748,7 +1776,10 @@ def get_cmdclass(cmdclass=None):
cmds = {} if cmdclass is None else cmdclass.copy()

# we add "version" to both distutils and setuptools
from distutils.core import Command
try:
from setuptools import Command
except ImportError:
from distutils.core import Command

class cmd_version(Command):
description = "report generated version string"
Expand Down

0 comments on commit 99aaecc

Please sign in to comment.