Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-findpython for openSUSE:Factory checked in at 2024-04-21 20:27:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-findpython (Old) and /work/SRC/openSUSE:Factory/.python-findpython.new.26366 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-findpython" Sun Apr 21 20:27:18 2024 rev:10 rq:1169372 version:0.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-findpython/python-findpython.changes 2024-01-06 18:41:16.189765304 +0100 +++ /work/SRC/openSUSE:Factory/.python-findpython.new.26366/python-findpython.changes 2024-04-21 20:28:47.365242306 +0200 @@ -1,0 +2,12 @@ +Sat Apr 20 14:05:16 UTC 2024 - Dirk Müller <dmuel...@suse.com> + +- update to 0.6.1: + * Ignore invalid version strinig from winreg +- update to 0.6.0: + * Support find by implementation +- update to 0.5.0: + * Add implementation property + * Drop support for python 3.7 + * Find rye pythons with and without install directory + +------------------------------------------------------------------- Old: ---- findpython-0.4.1.tar.gz New: ---- findpython-0.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-findpython.spec ++++++ --- /var/tmp/diff_new_pack.vvfXgd/_old 2024-04-21 20:28:48.777294143 +0200 +++ /var/tmp/diff_new_pack.vvfXgd/_new 2024-04-21 20:28:48.781294290 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-findpython -Version: 0.4.1 +Version: 0.6.1 Release: 0 Summary: Utility to find python versions on your system License: MIT @@ -36,7 +36,7 @@ BuildRequires: %{python_module pytest} # /SECTION Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives Requires: python-packaging >= 20 %python_subpackages ++++++ findpython-0.4.1.tar.gz -> findpython-0.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/PKG-INFO new/findpython-0.6.1/PKG-INFO --- old/findpython-0.4.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/findpython-0.6.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +1,17 @@ Metadata-Version: 2.1 Name: findpython -Version: 0.4.1 +Version: 0.6.1 Summary: A utility to find python versions on your system Author-Email: Frost Ming <miangh...@gmail.com> License: MIT Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.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: Programming Language :: Python :: 3.12 Project-URL: Homepage, https://github.com/frostming/findpython -Requires-Python: >=3.7 +Requires-Python: >=3.8 Requires-Dist: packaging>=20 Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/pyproject.toml new/findpython-0.6.1/pyproject.toml --- old/findpython-0.4.1/pyproject.toml 2023-12-07 05:39:20.101811400 +0100 +++ new/findpython-0.6.1/pyproject.toml 2024-04-18 13:15:58.019341000 +0200 @@ -7,18 +7,18 @@ dependencies = [ "packaging>=20", ] -requires-python = ">=3.7" +requires-python = ">=3.8" readme = "README.md" dynamic = [] classifiers = [ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] -version = "0.4.1" +version = "0.6.1" [project.license] text = "MIT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/src/findpython/__version__.py new/findpython-0.6.1/src/findpython/__version__.py --- old/findpython-0.4.1/src/findpython/__version__.py 2023-12-07 05:39:20.101811400 +0100 +++ new/findpython-0.6.1/src/findpython/__version__.py 2024-04-18 13:15:58.015341000 +0200 @@ -1 +1 @@ -__version__ = "0.4.1" +__version__ = "0.6.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/src/findpython/finder.py new/findpython-0.6.1/src/findpython/finder.py --- old/findpython-0.4.1/src/findpython/finder.py 2023-12-07 05:39:09.105851000 +0100 +++ new/findpython-0.6.1/src/findpython/finder.py 2024-04-18 13:15:49.651351000 +0200 @@ -66,6 +66,7 @@ name: str | None = None, architecture: str | None = None, allow_prereleases: bool = False, + implementation: str | None = None, ) -> list[PythonVersion]: """ Return all Python versions matching the given version criteria. @@ -78,6 +79,7 @@ :param name: The name of the python. :param architecture: The architecture of the python. :param allow_prereleases: Whether to allow prereleases. + :param implementation: The implementation of the python. E.g. "cpython", "pypy". :return: a list of PythonVersion objects """ if allow_prereleases and (pre is False or dev is False): @@ -101,6 +103,7 @@ pre = pre or None dev = dev or None architecture = version_dict["architecture"] + implementation = version_dict["implementation"] else: name, major = major, None @@ -113,6 +116,7 @@ dev, name, architecture, + implementation, ) # Deduplicate with the python executable path matched_python = set(self._find_all_python_versions()) @@ -128,6 +132,7 @@ name: str | None = None, architecture: str | None = None, allow_prereleases: bool = False, + implementation: str | None = None, ) -> PythonVersion | None: """ Return the Python version that is closest to the given version criteria. @@ -140,12 +145,21 @@ :param name: The name of the python. :param architecture: The architecture of the python. :param allow_prereleases: Whether to allow prereleases. + :param implementation: The implementation of the python. E.g. "cpython", "pypy". :return: a Python object or None """ return next( iter( self.find_all( - major, minor, patch, pre, dev, name, architecture, allow_prereleases + major, + minor, + patch, + pre, + dev, + name, + architecture, + allow_prereleases, + implementation, ) ), None, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/src/findpython/providers/rye.py new/findpython-0.6.1/src/findpython/providers/rye.py --- old/findpython-0.4.1/src/findpython/providers/rye.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/src/findpython/providers/rye.py 2024-04-18 13:15:49.651351000 +0200 @@ -1,6 +1,6 @@ from __future__ import annotations -import shutil +import os import typing as t from pathlib import Path @@ -10,24 +10,25 @@ class RyeProvider(BaseProvider): - def __init__(self) -> None: - self.root = Path.home() / ".rye" - self.rye_bin = shutil.which("rye") + def __init__(self, root: Path) -> None: + self.root = root @classmethod def create(cls) -> t.Self | None: - return cls() + root = Path(os.getenv("RYE_PY_ROOT", "~/.rye/py")).expanduser() + return cls(root) def find_pythons(self) -> t.Iterable[PythonVersion]: - py_root = self.root / "py" - if not py_root.exists(): + if not self.root.exists(): return - for child in safe_iter_dir(py_root): + for child in safe_iter_dir(self.root): if child.is_symlink(): # registered an existing python continue - if WINDOWS: - python_bin = child / "install/python.exe" - else: - python_bin = child / "install/bin/python3" - if python_bin.exists(): - yield self.version_maker(python_bin, _interpreter=python_bin) + for intermediate in ("", "install/"): + if WINDOWS: + python_bin = child / (intermediate + "python.exe") + else: + python_bin = child / (intermediate + "bin/python3") + if python_bin.exists(): + yield self.version_maker(python_bin, _interpreter=python_bin) + break diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/src/findpython/providers/winreg.py new/findpython-0.6.1/src/findpython/providers/winreg.py --- old/findpython-0.4.1/src/findpython/providers/winreg.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/src/findpython/providers/winreg.py 2024-04-18 13:15:49.651351000 +0200 @@ -4,6 +4,8 @@ import typing as t from pathlib import Path +from packaging.version import Version + from findpython.providers.base import BaseProvider from findpython.python import PythonVersion from findpython.utils import WINDOWS @@ -33,9 +35,16 @@ except AttributeError: continue if path.exists(): + py_version = getattr(version.info, "version", None) + parse_version: Version | None = None + if py_version: + try: + parse_version = Version(py_version) + except ValueError: + pass py_ver = self.version_maker( path, - None, + parse_version, getattr(version.info, "sys_architecture", SYS_ARCHITECTURE), path, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/src/findpython/python.py new/findpython-0.6.1/src/findpython/python.py --- old/findpython-0.4.1/src/findpython/python.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/src/findpython/python.py 2024-04-18 13:15:49.651351000 +0200 @@ -64,6 +64,12 @@ return self.executable @property + def implementation(self) -> str: + """Return the implementation of the python.""" + script = "import platform; print(platform.python_implementation())" + return _run_script(str(self.executable), script).strip() + + @property def name(self) -> str: """Return the name of the python.""" return self.executable.name @@ -125,6 +131,7 @@ dev: bool | None = None, name: str | None = None, architecture: str | None = None, + implementation: str | None = None, ) -> bool: """ Return True if the python matches the provided criteria. @@ -143,6 +150,8 @@ :type name: str :param architecture: The architecture of the python. :type architecture: str + :param implementation: The implementation of the python. + :type implementation: str :return: Whether the python matches the provided criteria. :rtype: bool """ @@ -160,19 +169,32 @@ return False if architecture is not None and self.architecture != architecture: return False + if ( + implementation is not None + and self.implementation.lower() != implementation.lower() + ): + return False return True def __hash__(self) -> int: return hash(self.executable) def __repr__(self) -> str: - attrs = ("executable", "version", "architecture", "major", "minor", "patch") + attrs = ( + "executable", + "version", + "architecture", + "implementation", + "major", + "minor", + "patch", + ) return "<PythonVersion {}>".format( ", ".join(f"{attr}={getattr(self, attr)!r}" for attr in attrs) ) def __str__(self) -> str: - return f"{self.name} {self.version} @ {self.executable}" + return f"{self.implementation:>9}@{self.version}: {self.executable}" def _get_version(self) -> Version: """Get the version of the python.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/src/findpython/utils.py new/findpython-0.6.1/src/findpython/utils.py --- old/findpython-0.4.1/src/findpython/utils.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/src/findpython/utils.py 2024-04-18 13:15:49.651351000 +0200 @@ -13,7 +13,7 @@ from typing import Generator, Sequence, TypedDict VERSION_RE = re.compile( - r"(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>[0-9]+))?)?\.?" + r"(?:(?P<implementation>\w+)@)?(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>[0-9]+))?)?\.?" r"(?:(?P<prerel>[abc]|rc|dev)(?:(?P<prerelversion>\d+(?:\.\d+)*))?)" r"?(?P<postdev>(\.post(?P<post>\d+))?(\.dev(?P<dev>\d+))?)?" r"(?:-(?P<architecture>32|64))?" @@ -129,6 +129,7 @@ minor: int | None patch: int | None architecture: str | None + implementation: str | None def parse_major(version: str) -> VersionDict | None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/tests/conftest.py new/findpython-0.6.1/tests/conftest.py --- old/findpython-0.4.1/tests/conftest.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/tests/conftest.py 2024-04-18 13:15:49.651351000 +0200 @@ -1,4 +1,5 @@ from pathlib import Path +from unittest.mock import PropertyMock import pytest from packaging.version import parse @@ -51,6 +52,10 @@ monkeypatch.setattr( "findpython.providers.base.BaseProvider.version_maker", mocked.version_maker ) + monkeypatch.setattr( + "findpython.python.PythonVersion.implementation", + PropertyMock(return_value="CPython"), + ) ALL_PROVIDERS.clear() ALL_PROVIDERS["path"] = PathProvider monkeypatch.setenv("PATH", str(tmp_path)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/tests/test_cli.py new/findpython-0.6.1/tests/test_cli.py --- old/findpython-0.4.1/tests/test_cli.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/tests/test_cli.py 2024-04-18 13:15:49.651351000 +0200 @@ -7,7 +7,7 @@ out, _ = capsys.readouterr() lines = out.strip().splitlines() for version, line in zip(("3.9", "3.8", "3.7"), lines): - assert line.startswith(f"python{version} {version}.0") + assert line.lstrip().startswith(f"CPython@{version}.0") def test_cli_find_python_by_version(mocked_python, capsys, tmp_path): @@ -15,5 +15,5 @@ assert retcode == 0 out, _ = capsys.readouterr() line = out.strip() - assert line.startswith("python3.8 3.8.0") + assert line.startswith("CPython@3.8.0") assert line.endswith(str(tmp_path / "python3.8")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.4.1/tests/test_posix.py new/findpython-0.6.1/tests/test_posix.py --- old/findpython-0.4.1/tests/test_posix.py 2023-12-07 05:39:09.109851000 +0100 +++ new/findpython-0.6.1/tests/test_posix.py 2024-04-18 13:15:49.651351000 +0200 @@ -82,8 +82,14 @@ python310 = mocked_python.add_python( tmp_path / ".rye/py/cpython@3.10.9/install/bin/python3", "3.10.9" ) + python311 = mocked_python.add_python( + tmp_path / ".rye/py/cpython@3.11.8/bin/python3", "3.11.8" + ) monkeypatch.setenv("HOME", str(tmp_path)) register_provider(RyeProvider) - pythons = Finder(selected_providers=["rye"]).find_all(3, 10) - assert python310 in pythons + find_310 = Finder(selected_providers=["rye"]).find_all(3, 10) + assert python310 in find_310 + + find_311 = Finder(selected_providers=["rye"]).find_all(3, 11) + assert python311 in find_311