Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-versioneer for openSUSE:Factory checked in at 2023-09-28 00:24:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-versioneer (Old) and /work/SRC/openSUSE:Factory/.python-versioneer.new.23327 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-versioneer" Thu Sep 28 00:24:40 2023 rev:8 rq:1113555 version:0.29 Changes: -------- --- /work/SRC/openSUSE:Factory/python-versioneer/python-versioneer.changes 2023-05-29 22:47:37.970249398 +0200 +++ /work/SRC/openSUSE:Factory/.python-versioneer.new.23327/python-versioneer.changes 2023-09-28 00:47:35.268705490 +0200 @@ -1,0 +2,11 @@ +Mon Sep 25 06:39:53 UTC 2023 - OndÅej Súkup <[email protected]> + +- update to 0.29 + * FIX: Add error output when pyproject.toml is malformed + * FIX: Add name to setup.py to work around a github dependency graph bug. + * ENH: Add basic type information throughout project. + * ENH: Detect pyproject.toml as project root (to support PDM). + * MNT: Overwrite version file instead of delete/unlink. + * MNT: Use https for the unlicense url. + +------------------------------------------------------------------- Old: ---- versioneer-0.28.tar.gz New: ---- versioneer-0.29.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-versioneer.spec ++++++ --- /var/tmp/diff_new_pack.RMBYlj/_old 2023-09-28 00:47:36.252741087 +0200 +++ /var/tmp/diff_new_pack.RMBYlj/_new 2023-09-28 00:47:36.256741232 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-versioneer -Version: 0.28 +Version: 0.29 Release: 0 Summary: VCS-based management of project version strings License: Unlicense @@ -34,7 +34,6 @@ BuildRequires: python-rpm-macros Requires(post): update-alternatives Requires(postun):update-alternatives -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch %python_subpackages ++++++ versioneer-0.28.tar.gz -> versioneer-0.29.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/LICENSE new/versioneer-0.29/LICENSE --- old/versioneer-0.28/LICENSE 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/LICENSE 2023-07-07 16:54:25.000000000 +0200 @@ -21,4 +21,4 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -For more information, please refer to <http://unlicense.org/> +For more information, please refer to <https://unlicense.org/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/PKG-INFO new/versioneer-0.29/PKG-INFO --- old/versioneer-0.28/PKG-INFO 2022-10-27 20:45:45.986500700 +0200 +++ new/versioneer-0.29/PKG-INFO 2023-07-07 16:54:42.201598200 +0200 @@ -1,9 +1,9 @@ Metadata-Version: 2.1 Name: versioneer -Version: 0.28 +Version: 0.29 Summary: Easy VCS-based management of project version strings Author: Brian Warner -Maintainer-email: Christopher Markiewicz <[email protected]>, Nathan Buckner <[email protected]> +Maintainer-email: Justin Wood <[email protected]>, Nathan Buckner <[email protected]> License: This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or @@ -27,7 +27,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - For more information, please refer to <http://unlicense.org/> + For more information, please refer to <https://unlicense.org/> Project-URL: Homepage, https://github.com/python-versioneer/python-versioneer Classifier: Programming Language :: Python @@ -36,6 +36,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: License :: OSI Approved :: The Unlicense (Unlicense) Requires-Python: >=3.7 Description-Content-Type: text/markdown @@ -49,7 +50,7 @@ * https://github.com/python-versioneer/python-versioneer * Brian Warner * License: Public Domain (Unlicense) -* Compatible with: Python 3.7, 3.8, 3.9, 3.10 and pypy3 +* Compatible with: Python 3.7, 3.8, 3.9, 3.10, 3.11 and pypy3 * [![Latest Version][pypi-image]][pypi-url] * [![Build Status][travis-image]][travis-url] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/README.md new/versioneer-0.29/README.md --- old/versioneer-0.28/README.md 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/README.md 2023-07-07 16:54:25.000000000 +0200 @@ -5,7 +5,7 @@ * https://github.com/python-versioneer/python-versioneer * Brian Warner * License: Public Domain (Unlicense) -* Compatible with: Python 3.7, 3.8, 3.9, 3.10 and pypy3 +* Compatible with: Python 3.7, 3.8, 3.9, 3.10, 3.11 and pypy3 * [![Latest Version][pypi-image]][pypi-url] * [![Build Status][travis-image]][travis-url] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/_version.py new/versioneer-0.29/_version.py --- old/versioneer-0.28/_version.py 2022-10-27 20:45:45.986500700 +0200 +++ new/versioneer-0.29/_version.py 2023-07-07 16:54:42.201598200 +0200 @@ -8,11 +8,11 @@ version_json = ''' { - "date": "2022-10-27T14:30:06-0400", + "date": "2023-07-07T10:50:03-0400", "dirty": false, "error": null, - "full-revisionid": "83f20fdf886df7a6089fca3bb7fc3c33198bd629", - "version": "0.28" + "full-revisionid": "28c613dbef5fce09dc3ba6b1baa811c2d76b2245", + "version": "0.29" } ''' # END VERSION_JSON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/pyproject.toml new/versioneer-0.29/pyproject.toml --- old/versioneer-0.28/pyproject.toml 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/pyproject.toml 2023-07-07 16:54:25.000000000 +0200 @@ -9,7 +9,7 @@ { name = "Brian Warner" }, ] maintainers = [ - { name = "Christopher Markiewicz", email = "[email protected]" }, + { name = "Justin Wood", email = "[email protected]" }, { name = "Nathan Buckner", email = "[email protected]" }, ] readme = "README.md" @@ -22,6 +22,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "License :: OSI Approved :: The Unlicense (Unlicense)", ] dynamic = ["version"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/setup.py new/versioneer-0.29/setup.py --- old/versioneer-0.28/setup.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/setup.py 2023-07-07 16:54:25.000000000 +0200 @@ -3,9 +3,10 @@ import os, base64, tempfile, io from importlib import util as ilu from pathlib import Path +from typing import List, Tuple from setuptools import setup, Command from setuptools.command.build_py import build_py -from setuptools.command.develop import develop +from setuptools.command.develop import develop as _develop # If versioneer is not installed in the environment, then we will need to # need to build and exec it. The build requires a VERSION, so we might need @@ -13,10 +14,16 @@ VERSION = "0+bootstrap" -def ver(s): +def ver(s: str) -> str: return s.replace("@VERSIONEER-VERSION@", VERSION) -def get(fn, add_ver=False, unquote=False, do_strip=False, do_readme=False): +def get( + fn: str, + add_ver: bool = False, + unquote: bool = False, + do_strip: bool = False, + do_readme: bool = False +) -> str: with open(fn) as f: text = f.read() @@ -31,14 +38,14 @@ text = text.replace("@README@", get("README.md")) return text -def get_vcs_list(): +def get_vcs_list() -> List[str]: project_path = Path(__file__).absolute().parent / "src" return [filename for filename in os.listdir(str(project_path)) if Path.is_dir(project_path / filename) and filename != "__pycache__"] -def generate_long_version_py(VCS): +def generate_long_version_py(VCS: str) -> str: s = io.StringIO() s.write(get(f"src/{VCS}/long_header.py", add_ver=True, do_strip=True)) for piece in ["src/subprocess_helper.py", @@ -50,7 +57,7 @@ s.write(get(piece, unquote=True, do_strip=True)) return s.getvalue() -def generate_versioneer_py(): +def generate_versioneer_py() -> bytes: s = io.StringIO() s.write(get("src/header.py", add_ver=True, do_readme=True, do_strip=True)) s.write(get("src/subprocess_helper.py", do_strip=True)) @@ -78,26 +85,25 @@ class make_versioneer(Command): description = "create standalone versioneer.py" - user_options = [] - boolean_options = [] - def initialize_options(self): + user_options: List[Tuple[str, str, str]] = [] + boolean_options: List[str] = [] + def initialize_options(self) -> None: pass - def finalize_options(self): + def finalize_options(self) -> None: pass - def run(self): + def run(self) -> None: with open("versioneer.py", "w") as f: f.write(generate_versioneer_py().decode("utf8")) - return 0 class make_long_version_py_git(Command): description = "create standalone _version.py (for git)" - user_options = [] - boolean_options = [] - def initialize_options(self): + user_options: List[Tuple[str, str, str]] = [] + boolean_options: List[str] = [] + def initialize_options(self) -> None: pass - def finalize_options(self): + def finalize_options(self) -> None: pass - def run(self): + def run(self) -> None: assert os.path.exists("versioneer.py") long_version = generate_long_version_py("git") with open("git_version.py", "w") as f: @@ -108,10 +114,9 @@ "PARENTDIR_PREFIX": "parentdir_prefix", "VERSIONFILE_SOURCE": "versionfile_source", }) - return 0 class my_build_py(build_py): - def run(self): + def run(self) -> None: v = generate_versioneer_py() v_b64 = base64.b64encode(v).decode("ascii") lines = [v_b64[i:i+60] for i in range(0, len(v_b64), 60)] @@ -124,23 +129,25 @@ installer.write_text(s) self.package_dir.update({'': os.path.relpath(installer.parent)}) - rc = build_py.run(self) - return rc + build_py.run(self) # The structure of versioneer, with its components that are compiled into a single file, # makes it unsuitable for development mode. -class develop(develop): - def run(self): +class develop(_develop): + def run(self) -> None: # type: ignore[override] raise RuntimeError("Versioneer cannot be installed in developer/editable mode.") # Bootstrap a versioneer module to guarantee that we get a compatible version -versioneer = ilu.module_from_spec(ilu.spec_from_loader('versioneer', loader=None)) +versioneer = ilu.module_from_spec( + ilu.spec_from_loader('versioneer', loader=None) # type: ignore[arg-type] +) exec(generate_versioneer_py(), versioneer.__dict__) VERSION = versioneer.get_version() setup( + name="versioneer", # need by GitHub dependency graph version=VERSION, py_modules=["versioneer"], cmdclass=versioneer.get_cmdclass({ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/cmdclass.py new/versioneer-0.29/src/cmdclass.py --- old/versioneer-0.28/src/cmdclass.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/cmdclass.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,13 +1,11 @@ import os, sys # --STRIP DURING BUILD -LONG_VERSION_PY = {} # --STRIP DURING BUILD -def get_version(): pass # --STRIP DURING BUILD -def get_versions(): pass # --STRIP DURING BUILD -def get_root(): pass # --STRIP DURING BUILD -def get_config_from_root(): pass # --STRIP DURING BUILD -def write_to_version_file(): pass # --STRIP DURING BUILD +from typing import Any, Dict, List, Optional, Tuple # --STRIP DURING BUILD +from .header import LONG_VERSION_PY, get_root, get_config_from_root # --STRIP DURING BUILD +from .get_versions import get_versions # --STRIP DURING BUILD +from .from_file import write_to_version_file # --STRIP DURING BUILD -def get_cmdclass(cmdclass=None): +def get_cmdclass(cmdclass: Optional[Dict[str, Any]] = None): """Get the custom setuptools subclasses used by Versioneer. If the package uses a different cmdclass (e.g. one from numpy), it @@ -35,16 +33,16 @@ class cmd_version(Command): description = "report generated version string" - user_options = [] - boolean_options = [] + user_options: List[Tuple[str, str, str]] = [] + boolean_options: List[str] = [] - def initialize_options(self): + def initialize_options(self) -> None: pass - def finalize_options(self): + def finalize_options(self) -> None: pass - def run(self): + def run(self) -> None: vers = get_versions(verbose=True) print("Version: %s" % vers["version"]) print(" full-revisionid: %s" % vers.get("full-revisionid")) @@ -74,12 +72,12 @@ # we override different "build_py" commands for both environments if 'build_py' in cmds: - _build_py = cmds['build_py'] + _build_py: Any = cmds['build_py'] else: from setuptools.command.build_py import build_py as _build_py class cmd_build_py(_build_py): - def run(self): + def run(self) -> None: root = get_root() cfg = get_config_from_root(root) versions = get_versions() @@ -98,12 +96,12 @@ cmds["build_py"] = cmd_build_py if 'build_ext' in cmds: - _build_ext = cmds['build_ext'] + _build_ext: Any = cmds['build_ext'] else: from setuptools.command.build_ext import build_ext as _build_ext class cmd_build_ext(_build_ext): - def run(self): + def run(self) -> None: root = get_root() cfg = get_config_from_root(root) versions = get_versions() @@ -130,7 +128,7 @@ cmds["build_ext"] = cmd_build_ext if "cx_Freeze" in sys.modules: # cx_freeze enabled? - from cx_Freeze.dist import build_exe as _build_exe + from cx_Freeze.dist import build_exe as _build_exe # type: ignore # nczeczulin reports that py2exe won't like the pep440-style string # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. # setup(console=[{ @@ -139,7 +137,7 @@ # ... class cmd_build_exe(_build_exe): - def run(self): + def run(self) -> None: root = get_root() cfg = get_config_from_root(root) versions = get_versions() @@ -163,12 +161,12 @@ if 'py2exe' in sys.modules: # py2exe enabled? try: - from py2exe.setuptools_buildexe import py2exe as _py2exe + from py2exe.setuptools_buildexe import py2exe as _py2exe # type: ignore except ImportError: - from py2exe.distutils_buildexe import py2exe as _py2exe + from py2exe.distutils_buildexe import py2exe as _py2exe # type: ignore class cmd_py2exe(_py2exe): - def run(self): + def run(self) -> None: root = get_root() cfg = get_config_from_root(root) versions = get_versions() @@ -191,12 +189,12 @@ # sdist farms its file list building out to egg_info if 'egg_info' in cmds: - _egg_info = cmds['egg_info'] + _egg_info: Any = cmds['egg_info'] else: from setuptools.command.egg_info import egg_info as _egg_info class cmd_egg_info(_egg_info): - def find_sources(self): + def find_sources(self) -> None: # egg_info.find_sources builds the manifest list and writes it # in one shot super().find_sources() @@ -228,12 +226,12 @@ # we override different "sdist" commands for both environments if 'sdist' in cmds: - _sdist = cmds['sdist'] + _sdist: Any = cmds['sdist'] else: from setuptools.command.sdist import sdist as _sdist class cmd_sdist(_sdist): - def run(self): + def run(self) -> None: versions = get_versions() self._versioneer_generated_versions = versions # unless we update this, the command will keep using the old @@ -241,7 +239,7 @@ self.distribution.metadata.version = versions["version"] return _sdist.run(self) - def make_release_tree(self, base_dir, files): + def make_release_tree(self, base_dir: str, files: List[str]) -> None: root = get_root() cfg = get_config_from_root(root) _sdist.make_release_tree(self, base_dir, files) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/from_file.py new/versioneer-0.29/src/from_file.py --- old/versioneer-0.28/src/from_file.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/from_file.py 2023-07-07 16:54:25.000000000 +0200 @@ -15,12 +15,12 @@ return json.loads(version_json) """ -import os # --STRIP DURING BUILD import json # --STRIP DURING BUILD import re # --STRIP DURING BUILD -class NotThisMethod(Exception): pass # --STRIP DURING BUILD +from typing import Any, Dict # --STRIP DURING BUILD +from .header import NotThisMethod # --STRIP DURING BUILD -def versions_from_file(filename): +def versions_from_file(filename: str) -> Dict[str, Any]: """Try to determine the version from _version.py if present.""" try: with open(filename) as f: @@ -37,9 +37,8 @@ return json.loads(mo.group(1)) -def write_to_version_file(filename, versions): +def write_to_version_file(filename: str, versions: Dict[str, Any]) -> None: """Write the given version number to the given _version.py file.""" - os.unlink(filename) contents = json.dumps(versions, sort_keys=True, indent=1, separators=(",", ": ")) with open(filename, "w") as f: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/from_parentdir.py new/versioneer-0.29/src/from_parentdir.py --- old/versioneer-0.28/src/from_parentdir.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/from_parentdir.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,6 +1,11 @@ import os # --STRIP DURING BUILD -class NotThisMethod(Exception): pass # --STRIP DURING BUILD -def versions_from_parentdir(parentdir_prefix, root, verbose): +from .header import NotThisMethod # --STRIP DURING BUILD +from typing import Any, Dict # --STRIP DURING BUILD +def versions_from_parentdir( + parentdir_prefix: str, + root: str, + verbose: bool, +) -> Dict[str, Any]: """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/get_versions.py new/versioneer-0.29/src/get_versions.py --- old/versioneer-0.28/src/get_versions.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/get_versions.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,17 +1,16 @@ import os, sys # --STRIP DURING BUILD -def get_root(): pass # --STRIP DURING BUILD -def get_config_from_root(): pass # --STRIP DURING BUILD -def versions_from_file(): pass # --STRIP DURING BUILD -def versions_from_parentdir(): pass # --STRIP DURING BUILD -def render(): pass # --STRIP DURING BUILD -HANDLERS = {} # --STRIP DURING BUILD -class NotThisMethod(Exception): pass # --STRIP DURING BUILD +from typing import Any, Dict # --STRIP DURING BUILD +from .header import HANDLERS, get_root, get_config_from_root # --STRIP DURING BUILD +from .header import NotThisMethod # --STRIP DURING BUILD +from .from_file import versions_from_file # --STRIP DURING BUILD +from .from_parentdir import versions_from_parentdir # --STRIP DURING BUILD +from .render import render # --STRIP DURING BUILD class VersioneerBadRootError(Exception): """The project root directory is unknown or missing key files.""" -def get_versions(verbose=False): +def get_versions(verbose: bool = False) -> Dict[str, Any]: """Get the project version from whatever source is available. Returns dict with two keys: 'version' and 'full'. @@ -26,7 +25,7 @@ assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg" handlers = HANDLERS.get(cfg.VCS) assert handlers, "unrecognized VCS '%s'" % cfg.VCS - verbose = verbose or cfg.verbose + verbose = verbose or bool(cfg.verbose) # `bool()` used to avoid `None` assert cfg.versionfile_source is not None, \ "please set versioneer.versionfile_source" assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" @@ -87,6 +86,6 @@ "date": None} -def get_version(): +def get_version() -> str: """Get the short version string for this project.""" return get_versions()["version"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/git/from_keywords.py new/versioneer-0.29/src/git/from_keywords.py --- old/versioneer-0.28/src/git/from_keywords.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/git/from_keywords.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,17 +1,14 @@ import re # --STRIP DURING BUILD -def register_vcs_handler(*args): # --STRIP DURING BUILD - def nil(f): # --STRIP DURING BUILD - return f # --STRIP DURING BUILD - return nil # --STRIP DURING BUILD -class NotThisMethod(Exception): pass # --STRIP DURING BUILD +from typing import Any, Dict # --STRIP DURING BUILD +from .long_header import NotThisMethod, register_vcs_handler # --STRIP DURING BUILD @register_vcs_handler("git", "get_keywords") -def git_get_keywords(versionfile_abs): +def git_get_keywords(versionfile_abs: str) -> Dict[str, str]: """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these # keywords. When used from setup.py, we don't want to import _version.py, # so we do it with a regexp instead. This function is not used from # _version.py. - keywords = {} + keywords: Dict[str, str] = {} try: with open(versionfile_abs, "r") as fobj: for line in fobj: @@ -33,7 +30,11 @@ @register_vcs_handler("git", "keywords") -def git_versions_from_keywords(keywords, tag_prefix, verbose): +def git_versions_from_keywords( + keywords: Dict[str, str], + tag_prefix: str, + verbose: bool, +) -> Dict[str, Any]: """Get version information from git keywords.""" if "refnames" not in keywords: raise NotThisMethod("Short version file found") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/git/from_vcs.py new/versioneer-0.29/src/git/from_vcs.py --- old/versioneer-0.28/src/git/from_vcs.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/git/from_vcs.py 2023-07-07 16:54:25.000000000 +0200 @@ -2,21 +2,18 @@ import re # --STRIP DURING BUILD import os # --STRIP DURING BUILD import functools # --STRIP DURING BUILD +from typing import Any, Callable, Dict # --STRIP DURING BUILD +from .long_header import NotThisMethod, register_vcs_handler # --STRIP DURING BUILD +from subprocess_helper import run_command # --STRIP DURING BUILD # --STRIP DURING BUILD # --STRIP DURING BUILD -def register_vcs_handler(*args): # --STRIP DURING BUILD - def nil(f): # --STRIP DURING BUILD - return f # --STRIP DURING BUILD - return nil # --STRIP DURING BUILD - # --STRIP DURING BUILD - # --STRIP DURING BUILD -def run_command(): pass # --STRIP DURING BUILD - # --STRIP DURING BUILD - # --STRIP DURING BUILD -class NotThisMethod(Exception): # --STRIP DURING BUILD - pass # --STRIP DURING BUILD @register_vcs_handler("git", "pieces_from_vcs") -def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): +def git_pieces_from_vcs( + tag_prefix: str, + root: str, + verbose: bool, + runner: Callable = run_command +) -> Dict[str, Any]: """Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* @@ -56,7 +53,7 @@ raise NotThisMethod("'git rev-parse' failed") full_out = full_out.strip() - pieces = {} + pieces: Dict[str, Any] = {} pieces["long"] = full_out pieces["short"] = full_out[:7] # maybe improved later pieces["error"] = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/git/install.py new/versioneer-0.29/src/git/install.py --- old/versioneer-0.28/src/git/install.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/git/install.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,7 +1,9 @@ +import os # --STRIP DURING BUILD import sys # --STRIP DURING BUILD -def run_command(): pass # --STRIP DURING BUILD +from typing import Optional # --STRIP DURING BUILD +from subprocess_helper import run_command # --STRIP DURING BUILD -def do_vcs_install(versionfile_source, ipy): +def do_vcs_install(versionfile_source: str, ipy: Optional[str]) -> None: """Git-specific installation logic for Versioneer. For Git, this means creating/changing .gitattributes to mark _version.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/git/long_get_versions.py new/versioneer-0.29/src/git/long_get_versions.py --- old/versioneer-0.28/src/git/long_get_versions.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/git/long_get_versions.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,13 +1,12 @@ import os # --STRIP DURING BUILD -def get_config(): pass # --STRIP DURING BUILD -def get_keywords(): pass # --STRIP DURING BUILD -def git_versions_from_keywords(): pass # --STRIP DURING BUILD -def git_pieces_from_vcs(): pass # --STRIP DURING BUILD -def versions_from_parentdir(): pass # --STRIP DURING BUILD -class NotThisMethod(Exception): pass # --STRIP DURING BUILD -def render(): pass # --STRIP DURING BUILD +from typing import Any, Dict # --STRIP DURING BUILD +from .long_header import get_config, get_keywords, NotThisMethod # --STRIP DURING BUILD +from .from_keywords import git_versions_from_keywords # --STRIP DURING BUILD +from .from_vcs import git_pieces_from_vcs # --STRIP DURING BUILD +from from_parentdir import versions_from_parentdir # --STRIP DURING BUILD +from render import render # --STRIP DURING BUILD -def get_versions(): +def get_versions() -> Dict[str, Any]: """Get version information or return default if unable to do so.""" # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have # __file__, we can work backwards from there to the root. Some diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/git/long_header.py new/versioneer-0.29/src/git/long_header.py --- old/versioneer-0.28/src/git/long_header.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/git/long_header.py 2023-07-07 16:54:25.000000000 +0200 @@ -15,11 +15,11 @@ import re import subprocess import sys -from typing import Callable, Dict +from typing import Any, Callable, Dict, List, Optional, Tuple import functools -def get_keywords(): +def get_keywords() -> Dict[str, str]: """Get the keywords needed to look up the version information.""" # these strings will be replaced by git during git-archive. # setup.py/versioneer.py will grep for the variable names, so they must @@ -35,8 +35,15 @@ class VersioneerConfig: """Container for Versioneer configuration parameters.""" + VCS: str + style: str + tag_prefix: str + parentdir_prefix: str + versionfile_source: str + verbose: bool -def get_config(): + +def get_config() -> VersioneerConfig: """Create, populate and return the VersioneerConfig() object.""" # these strings are filled in when 'setup.py versioneer' creates # _version.py @@ -58,9 +65,9 @@ HANDLERS: Dict[str, Dict[str, Callable]] = {} -def register_vcs_handler(vcs, method): # decorator +def register_vcs_handler(vcs: str, method: str) -> Callable: # decorator """Create decorator to mark a method as the handler of a VCS.""" - def decorate(f): + def decorate(f: Callable) -> Callable: """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/header.py new/versioneer-0.29/src/header.py --- old/versioneer-0.28/src/header.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/header.py 2023-07-07 16:54:25.000000000 +0200 @@ -19,7 +19,8 @@ import subprocess import sys from pathlib import Path -from typing import Callable, Dict +from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union +from typing import NoReturn import functools have_tomllib = True @@ -31,13 +32,21 @@ except ImportError: have_tomllib = False -class VersioneerBadRootError(Exception): ... # --STRIP DURING BUILD +from .get_versions import VersioneerBadRootError # --STRIP DURING BUILD class VersioneerConfig: """Container for Versioneer configuration parameters.""" + VCS: str + style: str + tag_prefix: str + versionfile_source: str + versionfile_build: Optional[str] + parentdir_prefix: Optional[str] + verbose: Optional[bool] -def get_root(): + +def get_root() -> str: """Get the project root directory. We require that all commands are run from the project root, i.e. the @@ -45,13 +54,23 @@ """ root = os.path.realpath(os.path.abspath(os.getcwd())) setup_py = os.path.join(root, "setup.py") + pyproject_toml = os.path.join(root, "pyproject.toml") versioneer_py = os.path.join(root, "versioneer.py") - if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): + if not ( + os.path.exists(setup_py) + or os.path.exists(pyproject_toml) + or os.path.exists(versioneer_py) + ): # allow 'python path/to/setup.py COMMAND' root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) setup_py = os.path.join(root, "setup.py") + pyproject_toml = os.path.join(root, "pyproject.toml") versioneer_py = os.path.join(root, "versioneer.py") - if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): + if not ( + os.path.exists(setup_py) + or os.path.exists(pyproject_toml) + or os.path.exists(versioneer_py) + ): err = ("Versioneer was unable to run the project root directory. " "Versioneer requires setup.py to be executed from " "its immediate directory (like 'python setup.py COMMAND'), " @@ -76,23 +95,24 @@ return root -def get_config_from_root(root): +def get_config_from_root(root: str) -> VersioneerConfig: """Read the project setup.cfg file to determine Versioneer config.""" # This might raise OSError (if setup.cfg is missing), or # configparser.NoSectionError (if it lacks a [versioneer] section), or # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . - root = Path(root) - pyproject_toml = root / "pyproject.toml" - setup_cfg = root / "setup.cfg" - section = None + root_pth = Path(root) + pyproject_toml = root_pth / "pyproject.toml" + setup_cfg = root_pth / "setup.cfg" + section: Union[Dict[str, Any], configparser.SectionProxy, None] = None if pyproject_toml.exists() and have_tomllib: try: with open(pyproject_toml, 'rb') as fobj: pp = tomllib.load(fobj) section = pp['tool']['versioneer'] - except (tomllib.TOMLDecodeError, KeyError): - pass + except (tomllib.TOMLDecodeError, KeyError) as e: + print(f"Failed to load config from {pyproject_toml}: {e}") + print("Try to load it from setup.cfg") if not section: parser = configparser.ConfigParser() with open(setup_cfg) as cfg_file: @@ -101,16 +121,25 @@ section = parser["versioneer"] + # `cast`` really shouldn't be used, but its simplest for the + # common VersioneerConfig users at the moment. We verify against + # `None` values elsewhere where it matters + cfg = VersioneerConfig() cfg.VCS = section['VCS'] cfg.style = section.get("style", "") - cfg.versionfile_source = section.get("versionfile_source") + cfg.versionfile_source = cast(str, section.get("versionfile_source")) cfg.versionfile_build = section.get("versionfile_build") - cfg.tag_prefix = section.get("tag_prefix") + cfg.tag_prefix = cast(str, section.get("tag_prefix")) if cfg.tag_prefix in ("''", '""', None): cfg.tag_prefix = "" cfg.parentdir_prefix = section.get("parentdir_prefix") - cfg.verbose = section.get("verbose") + if isinstance(section, configparser.SectionProxy): + # Make sure configparser translates to bool + cfg.verbose = section.getboolean("verbose") + else: + cfg.verbose = section.get("verbose") + return cfg @@ -123,9 +152,9 @@ HANDLERS: Dict[str, Dict[str, Callable]] = {} -def register_vcs_handler(vcs, method): # decorator +def register_vcs_handler(vcs: str, method: str) -> Callable: # decorator """Create decorator to mark a method as the handler of a VCS.""" - def decorate(f): + def decorate(f: Callable) -> Callable: """Store f in HANDLERS[vcs][method].""" HANDLERS.setdefault(vcs, {})[method] = f return f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/installer.py new/versioneer-0.29/src/installer.py --- old/versioneer-0.28/src/installer.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/installer.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys, base64 +from typing import NoReturn VERSIONEER_b64 = """ @VERSIONEER-INSTALLER@ @@ -13,7 +14,7 @@ # Stub overwritten by exec() -def setup_command(): ... +def setup_command() -> NoReturn: ... # type: ignore # Make versioneer usable via import exec(VERSIONEER.decode(), globals()) @@ -33,7 +34,7 @@ return "unknown version" -def vendor(): +def vendor() -> None: """Install versioneer into current directory""" try: oldver = detect_installed_version() @@ -47,7 +48,7 @@ print(f"versioneer.py ({newver}) installed into local tree") -def main(): +def main() -> NoReturn: usage = "Usage: versioneer install [--vendor|--no-vendor]" if len(sys.argv) < 2 or len(sys.argv) > 3: print(usage) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/render.py new/versioneer-0.29/src/render.py --- old/versioneer-0.28/src/render.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/render.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,12 +1,13 @@ +from typing import Any, Dict, Optional, Tuple # --STRIP DURING BUILD -def plus_or_dot(pieces): +def plus_or_dot(pieces: Dict[str, Any]) -> str: """Return a + if we don't already have one, else return a .""" if "+" in pieces.get("closest-tag", ""): return "." return "+" -def render_pep440(pieces): +def render_pep440(pieces: Dict[str, Any]) -> str: """Build up version string, with post-release "local version identifier". Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you @@ -31,7 +32,7 @@ return rendered -def render_pep440_branch(pieces): +def render_pep440_branch(pieces: Dict[str, Any]) -> str: """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] . The ".dev0" means not master branch. Note that .dev0 sorts backwards @@ -61,7 +62,7 @@ return rendered -def pep440_split_post(ver): +def pep440_split_post(ver: str) -> Tuple[str, Optional[int]]: """Split pep440 version string at the post-release segment. Returns the release segments before the post-release and the @@ -71,7 +72,7 @@ return vc[0], int(vc[1] or 0) if len(vc) == 2 else None -def render_pep440_pre(pieces): +def render_pep440_pre(pieces: Dict[str, Any]) -> str: """TAG[.postN.devDISTANCE] -- No -dirty. Exceptions: @@ -95,7 +96,7 @@ return rendered -def render_pep440_post(pieces): +def render_pep440_post(pieces: Dict[str, Any]) -> str: """TAG[.postDISTANCE[.dev0]+gHEX] . The ".dev0" means dirty. Note that .dev0 sorts backwards @@ -122,7 +123,7 @@ return rendered -def render_pep440_post_branch(pieces): +def render_pep440_post_branch(pieces: Dict[str, Any]) -> str: """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] . The ".dev0" means not master branch. @@ -151,7 +152,7 @@ return rendered -def render_pep440_old(pieces): +def render_pep440_old(pieces: Dict[str, Any]) -> str: """TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. @@ -173,7 +174,7 @@ return rendered -def render_git_describe(pieces): +def render_git_describe(pieces: Dict[str, Any]) -> str: """TAG[-DISTANCE-gHEX][-dirty]. Like 'git describe --tags --dirty --always'. @@ -193,7 +194,7 @@ return rendered -def render_git_describe_long(pieces): +def render_git_describe_long(pieces: Dict[str, Any]) -> str: """TAG-DISTANCE-gHEX[-dirty]. Like 'git describe --tags --dirty --always -long'. @@ -213,7 +214,7 @@ return rendered -def render(pieces, style): +def render(pieces: Dict[str, Any], style: str) -> Dict[str, Any]: """Render the given version pieces into the requested style.""" if pieces["error"]: return {"version": "unknown", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/setupfunc.py new/versioneer-0.29/src/setupfunc.py --- old/versioneer-0.28/src/setupfunc.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/setupfunc.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,10 +1,10 @@ +import configparser # --STRIP DURING BUILD import os, sys # --STRIP DURING BUILD -def get_root(): pass # --STRIP DURING BUILD -def get_config_from_root(): pass # --STRIP DURING BUILD -LONG_VERSION_PY = {} # --STRIP DURING BUILD -def do_vcs_install(): pass # --STRIP DURING BUILD -configparser = None # --STRIP DURING BUILD +from typing import NoReturn, Optional # --STRIP DURING BUILD +from .header import get_config_from_root, get_root # --STRIP DURING BUILD +from .header import LONG_VERSION_PY # --STRIP DURING BUILD +from .git.install import do_vcs_install # --STRIP DURING BUILD CONFIG_ERROR = """ setup.cfg is missing the necessary Versioneer configuration. You need @@ -55,7 +55,7 @@ """ -def do_setup(): +def do_setup() -> int: """Do main VCS-independent setup function for installing Versioneer.""" root = get_root() try: @@ -82,6 +82,7 @@ ipy = os.path.join(os.path.dirname(cfg.versionfile_source), "__init__.py") + maybe_ipy: Optional[str] = ipy if os.path.exists(ipy): try: with open(ipy, "r") as f: @@ -102,16 +103,16 @@ print(" %s unmodified" % ipy) else: print(" %s doesn't exist, ok" % ipy) - ipy = None + maybe_ipy = None # Make VCS-specific changes. For git, this means creating/changing # .gitattributes to mark _version.py for export-subst keyword # substitution. - do_vcs_install(cfg.versionfile_source, ipy) + do_vcs_install(cfg.versionfile_source, maybe_ipy) return 0 -def scan_setup_py(): +def scan_setup_py() -> int: """Validate the contents of setup.py against Versioneer's expectations.""" found = set() setters = False @@ -148,7 +149,7 @@ return errors -def setup_command(): +def setup_command() -> NoReturn: """Set up Versioneer and exit with appropriate error code.""" errors = do_setup() errors += scan_setup_py() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/src/subprocess_helper.py new/versioneer-0.29/src/subprocess_helper.py --- old/versioneer-0.28/src/subprocess_helper.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/src/subprocess_helper.py 2023-07-07 16:54:25.000000000 +0200 @@ -1,11 +1,18 @@ import sys, subprocess, errno # --STRIP DURING BUILD -def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, - env=None): +from typing import Any, Dict, List, Optional, Tuple # --STRIP DURING BUILD +def run_command( + commands: List[str], + args: List[str], + cwd: Optional[str] = None, + verbose: bool = False, + hide_stderr: bool = False, + env: Optional[Dict[str, str]] = None, +) -> Tuple[Optional[str], Optional[int]]: """Call the given command(s).""" assert isinstance(commands, list) process = None - popen_kwargs = {} + popen_kwargs: Dict[str, Any] = {} if sys.platform == "win32": # This hides the console window if pythonw.exe is used startupinfo = subprocess.STARTUPINFO() @@ -21,8 +28,7 @@ stderr=(subprocess.PIPE if hide_stderr else None), **popen_kwargs) break - except OSError: - e = sys.exc_info()[1] + except OSError as e: if e.errno == errno.ENOENT: continue if verbose: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/test/git/test_invocations.py new/versioneer-0.29/test/git/test_invocations.py --- old/versioneer-0.28/test/git/test_invocations.py 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/test/git/test_invocations.py 2023-07-07 16:54:25.000000000 +0200 @@ -307,7 +307,9 @@ def make_binary_wheelname(self, app): return "%s-2.0-%s-%s-%s.whl" % (app, - "".join([impl, impl_ver]), abi, plat.replace("-", "_")) + "".join([impl, impl_ver]), abi, + plat.replace("-", "_").replace(".", "_") + ) class SetuptoolsRepo(_Invocations, unittest.TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/tox.ini new/versioneer-0.29/tox.ini --- old/versioneer-0.28/tox.ini 2022-10-27 20:45:29.000000000 +0200 +++ new/versioneer-0.29/tox.ini 2023-07-07 16:54:25.000000000 +0200 @@ -35,6 +35,7 @@ pip>=20 build tomli; python_version < "3.11" + types-setuptools !pypy3: mypy commands = @@ -56,4 +57,4 @@ pyflakes test flake8 git_version.py versioneer.py pycodestyle --max-line-length=88 git_version.py versioneer.py - !pypy3: mypy git_version.py + !pypy3: mypy git_version.py versioneer.py src/installer.py setup.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versioneer-0.28/versioneer.egg-info/PKG-INFO new/versioneer-0.29/versioneer.egg-info/PKG-INFO --- old/versioneer-0.28/versioneer.egg-info/PKG-INFO 2022-10-27 20:45:45.000000000 +0200 +++ new/versioneer-0.29/versioneer.egg-info/PKG-INFO 2023-07-07 16:54:42.000000000 +0200 @@ -1,9 +1,9 @@ Metadata-Version: 2.1 Name: versioneer -Version: 0.28 +Version: 0.29 Summary: Easy VCS-based management of project version strings Author: Brian Warner -Maintainer-email: Christopher Markiewicz <[email protected]>, Nathan Buckner <[email protected]> +Maintainer-email: Justin Wood <[email protected]>, Nathan Buckner <[email protected]> License: This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or @@ -27,7 +27,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - For more information, please refer to <http://unlicense.org/> + For more information, please refer to <https://unlicense.org/> Project-URL: Homepage, https://github.com/python-versioneer/python-versioneer Classifier: Programming Language :: Python @@ -36,6 +36,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: License :: OSI Approved :: The Unlicense (Unlicense) Requires-Python: >=3.7 Description-Content-Type: text/markdown @@ -49,7 +50,7 @@ * https://github.com/python-versioneer/python-versioneer * Brian Warner * License: Public Domain (Unlicense) -* Compatible with: Python 3.7, 3.8, 3.9, 3.10 and pypy3 +* Compatible with: Python 3.7, 3.8, 3.9, 3.10, 3.11 and pypy3 * [![Latest Version][pypi-image]][pypi-url] * [![Build Status][travis-image]][travis-url]
