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 2023-05-11 12:33:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-findpython (Old) and /work/SRC/openSUSE:Factory/.python-findpython.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-findpython" Thu May 11 12:33:45 2023 rev:6 rq:1086128 version:0.2.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-findpython/python-findpython.changes 2023-02-01 16:52:13.854096977 +0100 +++ /work/SRC/openSUSE:Factory/.python-findpython.new.1533/python-findpython.changes 2023-05-11 12:34:11.618911684 +0200 @@ -1,0 +2,8 @@ +Wed May 10 19:32:02 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.2.5: + * UTF-8 encoding of shell command output on Windows + * Findpython failed if PATH env contains folder + with restricted access + +------------------------------------------------------------------- Old: ---- findpython-0.2.4.tar.gz New: ---- findpython-0.2.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-findpython.spec ++++++ --- /var/tmp/diff_new_pack.I9qsKY/_old 2023-05-11 12:34:12.018913650 +0200 +++ /var/tmp/diff_new_pack.I9qsKY/_new 2023-05-11 12:34:12.026913689 +0200 @@ -17,7 +17,7 @@ Name: python-findpython -Version: 0.2.4 +Version: 0.2.5 Release: 0 Summary: Utility to find python versions on your system License: MIT ++++++ findpython-0.2.4.tar.gz -> findpython-0.2.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.2.4/PKG-INFO new/findpython-0.2.5/PKG-INFO --- old/findpython-0.2.4/PKG-INFO 2023-01-31 05:43:09.920751000 +0100 +++ new/findpython-0.2.5/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: findpython -Version: 0.2.4 +Version: 0.2.5 Summary: A utility to find python versions on your system License: MIT Author-email: Frost Ming <miangh...@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.2.4/pyproject.toml new/findpython-0.2.5/pyproject.toml --- old/findpython-0.2.4/pyproject.toml 2023-01-31 05:42:55.856444000 +0100 +++ new/findpython-0.2.5/pyproject.toml 2023-05-10 10:27:49.053817000 +0200 @@ -17,7 +17,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", ] -version = "0.2.4" +version = "0.2.5" [project.license] text = "MIT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.2.4/src/findpython/providers/base.py new/findpython-0.2.5/src/findpython/providers/base.py --- old/findpython-0.2.4/src/findpython/providers/base.py 2023-01-31 05:42:55.856444000 +0100 +++ new/findpython-0.2.5/src/findpython/providers/base.py 2023-05-10 10:27:49.053817000 +0200 @@ -6,7 +6,7 @@ from typing import Callable, Iterable, Type, TypeVar from findpython.python import PythonVersion -from findpython.utils import path_is_python, path_is_readable +from findpython.utils import path_is_python, safe_iter_dir T = TypeVar("T", bound="BaseProvider") logger = logging.getLogger("findpython") @@ -17,7 +17,8 @@ version_maker: Callable[..., PythonVersion] = PythonVersion - @abc.abstractclassmethod + @classmethod + @abc.abstractmethod def create(cls: Type[T]) -> T | None: """Return an instance of the provider or None if it is not available""" pass @@ -38,14 +39,11 @@ If the pythons might be a wrapper script, don't set this to True. :returns: An iterable of PythonVersion objects """ - if not path_is_readable(path) or not path.is_dir(): - logger.debug("Invalid path or unreadable: %s", path) - return iter([]) return ( cls.version_maker( child.absolute(), _interpreter=child.absolute() if as_interpreter else None, ) - for child in path.iterdir() + for child in safe_iter_dir(path) if path_is_python(child) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.2.4/src/findpython/python.py new/findpython-0.2.5/src/findpython/python.py --- old/findpython-0.2.4/src/findpython/python.py 2023-01-31 05:42:55.860444000 +0100 +++ new/findpython-0.2.5/src/findpython/python.py 2023-05-10 10:27:49.053817000 +0200 @@ -181,9 +181,14 @@ """Run a script and return the output.""" command = [self.executable.as_posix(), "-c", script] logger.debug("Running script: %s", command) - return subprocess.check_output( - command, input=None, stderr=subprocess.DEVNULL, timeout=timeout - ).decode("utf-8") + return subprocess.run( + command, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + timeout=timeout, + check=True, + text=True, + ).stdout def __lt__(self, other: PythonVersion) -> bool: """Sort by the version, then by length of the executable path.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/findpython-0.2.4/src/findpython/utils.py new/findpython-0.2.5/src/findpython/utils.py --- old/findpython-0.2.4/src/findpython/utils.py 2023-01-31 05:42:55.860444000 +0100 +++ new/findpython-0.2.5/src/findpython/utils.py 2023-05-10 10:27:49.053817000 +0200 @@ -1,11 +1,13 @@ from __future__ import annotations +import errno import hashlib import os import re import sys from functools import lru_cache from pathlib import Path +from typing import Generator VERSION_RE = re.compile( r"(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>[0-9]+))?)?\.?" @@ -41,9 +43,18 @@ RE_MATCHER = re.compile(PY_MATCH_STR) -def path_is_readable(path: Path) -> bool: - """Return True if the path is readable.""" - return os.access(str(path), os.R_OK) +def safe_iter_dir(path: Path) -> Generator[Path, None, None]: + """Iterate over a directory, returning an empty iterator if the path + is not a directory or is not readable. + """ + if not os.access(str(path), os.R_OK) or not path.is_dir(): + return + try: + yield from path.iterdir() + except OSError as exc: + if exc.errno == errno.EACCES: + return + raise @lru_cache(maxsize=1024)