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 2022-08-16 17:07:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-findpython (Old)
and /work/SRC/openSUSE:Factory/.python-findpython.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-findpython"
Tue Aug 16 17:07:50 2022 rev:2 rq:995831 version:0.2.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-findpython/python-findpython.changes
2022-06-17 21:23:12.210795842 +0200
+++
/work/SRC/openSUSE:Factory/.python-findpython.new.1521/python-findpython.changes
2022-08-16 17:07:51.787899527 +0200
@@ -1,0 +2,10 @@
+Mon Aug 15 16:16:58 UTC 2022 - Ben Greiner <[email protected]>
+
+- Update to 0.2.1
+ * Fix the python detection logic to try the fast method first
+- Release 0.2.0
+ * Allow provider to keep symlink even when resolve_symlinks is
+ True
+- Fix requirements
+
+-------------------------------------------------------------------
Old:
----
findpython-0.1.6.tar.gz
New:
----
findpython-0.2.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-findpython.spec ++++++
--- /var/tmp/diff_new_pack.4clcoE/_old 2022-08-16 17:07:52.279900998 +0200
+++ /var/tmp/diff_new_pack.4clcoE/_new 2022-08-16 17:07:52.283901010 +0200
@@ -16,19 +16,17 @@
#
-%{?!python_module:%define python_module() python3-%{**}}
Name: python-findpython
-Version: 0.1.6
+Version: 0.2.1
Release: 0
-Summary: Utility to find python versions on your system.
+Summary: Utility to find python versions on your system
License: MIT
URL: https://github.com/frostming/findpython
Source:
https://files.pythonhosted.org/packages/source/f/findpython/findpython-%{version}.tar.gz
+BuildRequires: %{python_module base >= 3.7}
+BuildRequires: %{python_module packaging >= 20}
BuildRequires: %{python_module pdm-pep517}
BuildRequires: %{python_module pip}
-BuildRequires: %{python_module poetry}
-BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: git
BuildRequires: python-rpm-macros
@@ -38,6 +36,7 @@
# /SECTION
Requires(post): update-alternatives
Requires(postun):update-alternatives
+Requires: python-packaging >= 20
%python_subpackages
%description
@@ -68,6 +67,7 @@
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/findpython
-%{python_sitelib}/findpython*
+%{python_sitelib}/findpython
+%{python_sitelib}/findpython-%{version}*-info
%changelog
++++++ findpython-0.1.6.tar.gz -> findpython-0.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/PKG-INFO
new/findpython-0.2.1/PKG-INFO
--- old/findpython-0.1.6/PKG-INFO 2022-04-19 09:50:00.548011800 +0200
+++ new/findpython-0.2.1/PKG-INFO 2022-08-09 11:02:26.257062000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: findpython
-Version: 0.1.6
+Version: 0.2.1
Summary: A utility to find python versions on your system
License: MIT
Author-email: Frost Ming <[email protected]>
@@ -12,82 +12,91 @@
Classifier: Programming Language :: Python :: 3.9
Project-URL: Homepage, https://github.com/frostming/findpython
Description-Content-Type: text/markdown
-Description: # FindPython
-
- _A utility to find python versions on your system._
-
-
[](https://github.com/frostming/findpython/actions/workflows/ci.yml)
-
[](https://pypi.org/project/findpython)
- [](https://pypi.org/project/findpython)
-
[](https://github.com/frostming/findpython)
-
- ## Description
-
- This library is a rewrite of [pythonfinder] project by
[@techalchemy][techalchemy].
- It simplifies the whole code structure while preserving most of the
original features.
-
- [pythonfinder]: https://github.com/sarugaku/pythonfinder
- [techalchemy]: https://github.com/techalchemy
-
- ## Installation
-
- FindPython is installable via any kind of package manager including
`pip`:
-
- ```bash
- pip install findpython
- ```
-
- ## Usage
-
- ```python
- >>> import findpython
- >>> findpython.find(3, 9) # Find by major and minor version
- <PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
- >>> findpython.find("3.9") # Find by version string
- <PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
- >>> findpython.find("3.9-32") # Find by version string and
architecture
- <PythonVersion
executable=WindowsPath('C:\\Python\\3.9-32\\python.exe'),
version=<Version('3.9.10')>, architecture='32bit', major=3, minor=9, patch=10>
- >>> findpython.find(name="python3") # Find by executable name
- <PythonVersion
executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'),
version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
- >>> findpython.find("python3") # Find by executable name without
keyword argument, same as above
- <PythonVersion
executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'),
version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
- >>> findpython.find_all(major=3, minor=9) # Same arguments as
`find()`, but return all matches
- [<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>,
<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>,
<PythonVersion
executable=PosixPath('/Users/fming/Library/PythonUp/cmd/python3.9'),
version=<Version('3.9.9')>, architecture='64bit', major=3, minor=9, patch=9>,
<PythonVersion executable=PosixPath('/usr/local/bin/python3.9'),
version=<Version('3.9.5')>, architecture='64bit', major=3, minor=9, patch=5>,
<PythonVersion executable=PosixPath('/usr/local/bin/python3'),
version=<Version('3.9.5')>, architecture='64bit', major=3, minor=9, patch=5>]
- ```
-
- ## CLI Usage
-
- In addition, FindPython provides a CLI interface to find python
versions:
-
- ```
- usage: findpython [-h] [-V] [-a] [--resolve-symlink] [-v]
[--no-same-file] [--no-same-python] [version_spec]
-
- Find python files in a directory
-
- positional arguments:
- version_spec Python version spec or name
-
- options:
- -h, --help show this help message and exit
- -V, --version show program's version number and exit
- -a, --all Show all matching python versions
- --resolve-symlink Resolve all symlinks
- -v, --verbose Verbose output
- --no-same-file Eliminate the duplicated results with the same
file contents
- --no-same-python Eliminate the duplicated results with the same
sys.executable
- ```
-
- ## Integration
-
- FindPython finds Python from the following places:
-
- - `PATH` environment variable
- - pyenv
- - asdf
- - `/Library/Frameworks/Python.framework/Versions` (MacOS)
- - winreg (Windows)
-
- ## License
-
- FindPython is released under MIT License.
+
+# FindPython
+
+_A utility to find python versions on your system._
+
+[](https://github.com/frostming/findpython/actions/workflows/ci.yml)
+[](https://pypi.org/project/findpython)
+[](https://pypi.org/project/findpython)
+[](https://github.com/frostming/findpython)
+
+## Description
+
+This library is a rewrite of [pythonfinder] project by
[@techalchemy][techalchemy].
+It simplifies the whole code structure while preserving most of the original
features.
+
+[pythonfinder]: https://github.com/sarugaku/pythonfinder
+[techalchemy]: https://github.com/techalchemy
+
+## Installation
+
+FindPython is installable via any kind of package manager including `pip`:
+
+```bash
+pip install findpython
+```
+
+<details>
+<summary>Expand this section to see findpython's availability in the package
ecosystem</summary>
+
+<a href="https://repology.org/project/python:findpython/versions">
+ <img
src="https://repology.org/badge/vertical-allrepos/python:findpython.svg?header=python%3Afindpython"
alt="Packaging status">
+</a>
+</details>
+
+## Usage
+
+```python
+>>> import findpython
+>>> findpython.find(3, 9) # Find by major and minor version
+<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
+>>> findpython.find("3.9") # Find by version string
+<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
+>>> findpython.find("3.9-32") # Find by version string and architecture
+<PythonVersion executable=WindowsPath('C:\\Python\\3.9-32\\python.exe'),
version=<Version('3.9.10')>, architecture='32bit', major=3, minor=9, patch=10>
+>>> findpython.find(name="python3") # Find by executable name
+<PythonVersion
executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'),
version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
+>>> findpython.find("python3") # Find by executable name without keyword
argument, same as above
+<PythonVersion
executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'),
version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
+>>> findpython.find_all(major=3, minor=9) # Same arguments as `find()`, but
return all matches
+[<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>,
<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3'),
version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>,
<PythonVersion
executable=PosixPath('/Users/fming/Library/PythonUp/cmd/python3.9'),
version=<Version('3.9.9')>, architecture='64bit', major=3, minor=9, patch=9>,
<PythonVersion executable=PosixPath('/usr/local/bin/python3.9'),
version=<Version('3.9.5')>, architecture='64bit', major=3, minor=9, patch=5>,
<PythonVersion executable=PosixPath('/usr/local/bin/python3'),
version=<Version('3.9.5')>, architecture='64bit', major=3, minor=9, patch=5>]
+```
+
+## CLI Usage
+
+In addition, FindPython provides a CLI interface to find python versions:
+
+```
+usage: findpython [-h] [-V] [-a] [--resolve-symlink] [-v] [--no-same-file]
[--no-same-python] [version_spec]
+
+Find python files in a directory
+
+positional arguments:
+ version_spec Python version spec or name
+
+options:
+ -h, --help show this help message and exit
+ -V, --version show program's version number and exit
+ -a, --all Show all matching python versions
+ --resolve-symlink Resolve all symlinks
+ -v, --verbose Verbose output
+ --no-same-file Eliminate the duplicated results with the same file
contents
+ --no-same-python Eliminate the duplicated results with the same
sys.executable
+```
+
+## Integration
+
+FindPython finds Python from the following places:
+
+- `PATH` environment variable
+- pyenv
+- asdf
+- `/Library/Frameworks/Python.framework/Versions` (MacOS)
+- winreg (Windows)
+
+## License
+
+FindPython is released under MIT License.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/README.md
new/findpython-0.2.1/README.md
--- old/findpython-0.1.6/README.md 2022-04-19 09:49:50.620116700 +0200
+++ new/findpython-0.2.1/README.md 2022-08-09 11:02:05.573006200 +0200
@@ -23,6 +23,14 @@
pip install findpython
```
+<details>
+<summary>Expand this section to see findpython's availability in the package
ecosystem</summary>
+
+<a href="https://repology.org/project/python:findpython/versions">
+ <img
src="https://repology.org/badge/vertical-allrepos/python:findpython.svg?header=python%3Afindpython"
alt="Packaging status">
+</a>
+</details>
+
## Usage
```python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/pyproject.toml
new/findpython-0.2.1/pyproject.toml
--- old/findpython-0.1.6/pyproject.toml 2022-04-19 09:49:50.620116700 +0200
+++ new/findpython-0.2.1/pyproject.toml 2022-08-09 11:02:05.573006200 +0200
@@ -17,7 +17,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
-version = "0.1.6"
+version = "0.2.1"
[project.license]
text = "MIT"
@@ -28,16 +28,15 @@
[project.scripts]
findpython = "findpython.__main__:main"
-[tool.pdm]
-package-dir = "src"
-
[tool.pdm.version]
-from = "src/findpython/__init__.py"
+source = "scm"
+write_to = "findpython/__version__.py"
+write_template = "__version__ = \"{}\"\n"
+
+[tool.pdm.build]
+package-dir = "src"
[tool.pdm.dev-dependencies]
-dev = [
- "vendoring; python_version >= '3.8'",
-]
tests = [
"pytest",
]
@@ -55,16 +54,6 @@
"findpython",
]
-[tool.vendoring]
-destination = "src/findpython/_vendor/"
-requirements = "src/findpython/_vendor/vendor.txt"
-namespace = "findpython._vendor"
-protected-files = [
- "__init__.py",
- "README.md",
- "vendor.txt",
-]
-
[build-system]
requires = [
"pdm-pep517",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/src/findpython/__init__.py
new/findpython-0.2.1/src/findpython/__init__.py
--- old/findpython-0.1.6/src/findpython/__init__.py 2022-04-19
09:49:50.620116700 +0200
+++ new/findpython-0.2.1/src/findpython/__init__.py 2022-08-09
11:02:05.573006200 +0200
@@ -8,8 +8,6 @@
from findpython.finder import Finder
from findpython.python import PythonVersion
-__version__ = "0.1.6"
-
def find(*args, **kwargs) -> PythonVersion | None:
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/src/findpython/__main__.py
new/findpython-0.2.1/src/findpython/__main__.py
--- old/findpython-0.1.6/src/findpython/__main__.py 2022-04-19
09:49:50.620116700 +0200
+++ new/findpython-0.2.1/src/findpython/__main__.py 2022-08-09
11:02:05.573006200 +0200
@@ -5,7 +5,8 @@
from argparse import ArgumentParser
from typing import List
-from findpython import Finder, __version__
+from findpython import Finder
+from findpython.__version__ import __version__
logger = logging.getLogger("findpython")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/src/findpython/__version__.py
new/findpython-0.2.1/src/findpython/__version__.py
--- old/findpython-0.1.6/src/findpython/__version__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/findpython-0.2.1/src/findpython/__version__.py 2022-08-09
11:02:05.573006200 +0200
@@ -0,0 +1 @@
+__version__ = "0.0.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/src/findpython/finder.py
new/findpython-0.2.1/src/findpython/finder.py
--- old/findpython-0.1.6/src/findpython/finder.py 2022-04-19
09:49:50.620116700 +0200
+++ new/findpython-0.2.1/src/findpython/finder.py 2022-08-09
11:02:05.573006200 +0200
@@ -41,6 +41,15 @@
providers.append(provider)
return providers
+ def add_provider(self, provider: BaseProvider, pos: int | None = None) ->
None:
+ """Add provider to the provider list.
+ If pos is given, it will be inserted at the given position.
+ """
+ if pos is not None:
+ self._providers.insert(pos, provider)
+ else:
+ self._providers.append(provider)
+
def find_all(
self,
major: int | str | None = None,
@@ -136,12 +145,13 @@
return python_version.interpreter.as_posix()
if self.no_same_file:
return python_version.binary_hash()
- if self.resolve_symlinks:
+ if self.resolve_symlinks and not python_version.keep_symlink:
return python_version.real_path.as_posix()
return python_version.executable.as_posix()
def sort_key(python_version: PythonVersion) -> tuple[int, int]:
return (
+ python_version.executable.is_symlink(),
get_suffix_preference(python_version.name),
-len(python_version.executable.as_posix()),
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/src/findpython/python.py
new/findpython-0.2.1/src/findpython/python.py
--- old/findpython-0.1.6/src/findpython/python.py 2022-04-19
09:49:50.620116700 +0200
+++ new/findpython-0.2.1/src/findpython/python.py 2022-08-09
11:02:05.573006200 +0200
@@ -23,6 +23,7 @@
_version: Version | None = None
_architecture: str | None = None
_interpreter: Path | None = None
+ keep_symlink: bool = False
def is_valid(self) -> bool:
"""Return True if the python is not broken."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/src/findpython/utils.py
new/findpython-0.2.1/src/findpython/utils.py
--- old/findpython-0.1.6/src/findpython/utils.py 2022-04-19
09:49:50.620116700 +0200
+++ new/findpython-0.2.1/src/findpython/utils.py 2022-08-09
11:02:05.573006200 +0200
@@ -57,11 +57,14 @@
:return: True if the path has chmod +x, or is a readable, known executable
extension.
:rtype: bool
"""
- return (
- os.access(str(path), os.X_OK)
- or os.access(str(path), os.R_OK)
- and path.suffix in KNOWN_EXTS
- )
+ try:
+ return (
+ path.is_file()
+ and os.access(str(path), os.R_OK)
+ and (path.suffix in KNOWN_EXTS or os.access(str(path), os.X_OK))
+ )
+ except OSError:
+ return False
@lru_cache(maxsize=1024)
@@ -90,12 +93,7 @@
:return: Whether the provided path is an executable path to python.
:rtype: bool
"""
- try:
- if not path_is_readable(path) or not path.is_file():
- return False
- except OSError:
- return False
- return path_is_known_executable(path) and looks_like_python(path.name)
+ return looks_like_python(path.name) and path_is_known_executable(path)
@lru_cache(maxsize=1024)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/tests/conftest.py
new/findpython-0.2.1/tests/conftest.py
--- old/findpython-0.1.6/tests/conftest.py 2022-04-19 09:49:50.620116700
+0200
+++ new/findpython-0.2.1/tests/conftest.py 2022-08-09 11:02:05.573006200
+0200
@@ -12,7 +12,12 @@
self.versions = {}
def add_python(
- self, executable, version=None, architecture="64bit", interpreter=None
+ self,
+ executable,
+ version=None,
+ architecture="64bit",
+ interpreter=None,
+ keep_symlink=False,
):
if version is not None:
version = parse(version)
@@ -22,7 +27,9 @@
executable.parent.mkdir(parents=True, exist_ok=True)
executable.touch(exist_ok=True)
executable.chmod(0o744)
- py_ver = PythonVersion(executable, version, architecture, interpreter)
+ py_ver = PythonVersion(
+ executable, version, architecture, interpreter, keep_symlink
+ )
if version is not None:
py_ver._get_version = lambda: version
self.versions[executable] = py_ver
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/tests/test_finder.py
new/findpython-0.2.1/tests/test_finder.py
--- old/findpython-0.1.6/tests/test_finder.py 2022-04-19 09:49:50.620116700
+0200
+++ new/findpython-0.2.1/tests/test_finder.py 2022-08-09 11:02:05.573006200
+0200
@@ -1,6 +1,7 @@
import os
from pathlib import Path
+import pytest
from packaging.version import Version
from findpython import Finder
@@ -86,6 +87,20 @@
assert (new_python in all_pythons) is not switch
[email protected](os.name == "nt", reason="Not supported on Windows")
+def test_find_python_deduplicate_symlinks(mocked_python, tmp_path):
+ python = mocked_python.add_python(tmp_path / "python3.9", "3.9.0")
+ (tmp_path / "python3").symlink_to(python.executable)
+ symlink1 = mocked_python.add_python(tmp_path / "python3", "3.9.0")
+ (tmp_path / "python").symlink_to(python.executable)
+ symlink2 = mocked_python.add_python(tmp_path / "python", "3.9.0",
keep_symlink=True)
+ finder = Finder(resolve_symlinks=True)
+ all_pythons = finder.find_all()
+ assert python in all_pythons
+ assert symlink1 not in all_pythons
+ assert symlink2 in all_pythons
+
+
def test_find_python_deduplicate_same_interpreter(mocked_python, tmp_path,
switch):
if os.name == "nt":
suffix = ".bat"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/findpython-0.1.6/tests/test_posix.py
new/findpython-0.2.1/tests/test_posix.py
--- old/findpython-0.1.6/tests/test_posix.py 2022-04-19 09:49:50.620116700
+0200
+++ new/findpython-0.2.1/tests/test_posix.py 2022-08-09 11:02:05.573006200
+0200
@@ -39,7 +39,7 @@
try:
finder = Finder()
all_pythons = finder.find_all()
- assert len(all_pythons) == 2
+ assert len(all_pythons) == 2, all_pythons
assert python not in [version.executable for version in all_pythons]
finally:
python.chmod(0o744)