Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update versioneer #174

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions caput/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# This file is released into the public domain. Generated by
# versioneer-0.18 (https://github.com/warner/python-versioneer)

# pylint: skip-file

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

import errno
Expand Down Expand Up @@ -56,7 +58,7 @@ class NotThisMethod(Exception):


def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
"""Create decorator to mark a method as the handler of a VCS."""

def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
Expand Down Expand Up @@ -116,7 +118,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
"""
rootdirs = []

for _ in range(3):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i is still not used here, so this will trigger some linter warnings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that! I want to ignore the linter warnings for this file, but would you prefer for me to modify _version.py?

for i in range(3):
dirname = os.path.basename(root)
if dirname.startswith(parentdir_prefix):
return {
Expand Down Expand Up @@ -241,7 +243,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]

_, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True)
anjakefala marked this conversation as resolved.
Show resolved Hide resolved
out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True)
if rc != 0:
if verbose:
print("Directory %s not under git control" % root)
Expand Down Expand Up @@ -409,7 +411,7 @@ def render_pep440_old(pieces):

The ".dev0" means dirty.

Eexceptions:
Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
Expand Down Expand Up @@ -524,7 +526,7 @@ def get_versions():
# versionfile_source is the relative path from the top of the source
# tree (where the .git directory might live) to this file. Invert
# this to find the root from __file__.
for _ in cfg.versionfile_source.split("/"):
anjakefala marked this conversation as resolved.
Show resolved Hide resolved
for i in cfg.versionfile_source.split("/"):
root = os.path.dirname(root)
except NameError:
return {
Expand Down
46 changes: 27 additions & 19 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
* Brian Warner
* License: Public Domain
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy
* [![Latest Version]
(https://pypip.in/version/versioneer/badge.svg?style=flat)
](https://pypi.python.org/pypi/versioneer/)
* [![Build Status]
(https://travis-ci.org/warner/python-versioneer.png?branch=master)
](https://travis-ci.org/warner/python-versioneer)
* [![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
python projects. The goal is to remove the tedious and error-prone "update
Expand Down Expand Up @@ -179,7 +175,7 @@
`setup.cfg`, and `tox.ini`. Projects like these produce multiple PyPI
distributions (and upload multiple independently-installable tarballs).
* Source trees whose main purpose is to contain a C library, but which also
provide bindings to Python (and perhaps other langauges) in subdirectories.
provide bindings to Python (and perhaps other languages) in subdirectories.

Versioneer will look for `.git` in parent directories, and most operations
should get the right version string. However `pip` and `setuptools` have bugs
Expand Down Expand Up @@ -273,9 +269,13 @@
Dedication" license (CC0-1.0), as described in
https://creativecommons.org/publicdomain/zero/1.0/ .

"""
[pypi-image]: https://img.shields.io/pypi/v/versioneer.svg
[pypi-url]: https://pypi.python.org/pypi/versioneer/
[travis-image]:
https://img.shields.io/travis/warner/python-versioneer/master.svg
[travis-url]: https://travis-ci.org/warner/python-versioneer

from __future__ import print_function
"""

try:
import configparser
Expand Down Expand Up @@ -376,7 +376,7 @@ class NotThisMethod(Exception):


def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
"""Create decorator to mark a method as the handler of a VCS."""

def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
Expand Down Expand Up @@ -488,7 +488,7 @@ class NotThisMethod(Exception):


def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
"""Create decorator to mark a method as the handler of a VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
Expand Down Expand Up @@ -816,7 +816,7 @@ def render_pep440_old(pieces):

The ".dev0" means dirty.

Eexceptions:
Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
Expand Down Expand Up @@ -1339,7 +1339,7 @@ def render_pep440_old(pieces):

The ".dev0" means dirty.

Eexceptions:
Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
Expand Down Expand Up @@ -1524,8 +1524,12 @@ def get_version():
return get_versions()["version"]


def get_cmdclass():
"""Get the custom setuptools/distutils subclasses used by Versioneer."""
def get_cmdclass(cmdclass=None):
"""Get the custom setuptools/distutils subclasses used by Versioneer.

If the package uses a different cmdclass (e.g. one from numpy), it
should be provide as an argument.
"""
if "versioneer" in sys.modules:
del sys.modules["versioneer"]
# this fixes the "python setup.py develop" case (also 'install' and
Expand All @@ -1541,7 +1545,7 @@ def get_cmdclass():
# happens, we protect the child from the parent's versioneer too.
# Also see https://github.com/warner/python-versioneer/issues/52

cmds = {}
cmds = {} if cmdclass is None else cmdclass.copy()

# we add "version" to both distutils and setuptools
from distutils.core import Command
Expand Down Expand Up @@ -1584,7 +1588,9 @@ def run(self):
# setup.py egg_info -> ?

# we override different "build_py" commands for both environments
if "setuptools" in sys.modules:
if "build_py" in cmds:
_build_py = cmds["build_py"]
elif "setuptools" in sys.modules:
from setuptools.command.build_py import build_py as _build_py
else:
from distutils.command.build_py import build_py as _build_py
Expand Down Expand Up @@ -1674,7 +1680,9 @@ def run(self):
cmds["py2exe"] = cmd_py2exe

# we override different "sdist" commands for both environments
if "setuptools" in sys.modules:
if "sdist" in cmds:
_sdist = cmds["sdist"]
elif "setuptools" in sys.modules:
from setuptools.command.sdist import sdist as _sdist
else:
from distutils.command.sdist import sdist as _sdist
Expand Down Expand Up @@ -1751,7 +1759,7 @@ def make_release_tree(self, base_dir, files):


def do_setup():
"""Main VCS-independent setup function for installing Versioneer."""
"""Do main VCS-independent setup function for installing Versioneer."""
root = get_root()
try:
cfg = get_config_from_root(root)
Expand Down