SHA256
1
0
forked from pool/python-pdm

Accepting request 1036217 from devel:languages:python

- Add findpython-022.patch to make package work with findpython
  0.2.2 (from gh#pdm-project/pdm#1516).
- Skip failing test (gh#pdm-project/pdm#1516).
- Update to v2.2.1 
  Features & Improvements#
  * Make sitecustomize.py respect the PDM_PROJECT_MAX_DEPTH environment variable #1471
  Bug Fixes#
  * Fix the comparison of python_version in the environment marker. When the version contains only one digit, the result was incorrect. #1484
- Update to v2.2.0
  Features & Improvements#
  * Add venv.prompt configuration to allow customizing prompt when a virtualenv is activated #1332
  * Allow the use of custom CA certificates per publish repository using ca_certs or from the command line via pdm publish --ca-certs <path> .... #1392
  * Rename the plugin command to self, and it can not only manage plugins but also all dependencies. Add a subcommand self update to update PDM itself. #1406
  * Allow pdm init to receive a Python path or version via --python option. #1412
  * Add a default value for requires-python when importing from other formats. #1426
  * Use pdm instead of pip to resolve and install build requirements. So that PDM configurations can control the process. #1429
  * Customizable color theme via pdm config command. #1450
  * A new pdm lock --check flag to validate whether the lock is up to date. #1459
  * Add both option and config item to ship pip when creating a new venv. #1463
  * Issue warning and skip the requirement if it has the same name as the current project. #1466
  * Enhance the pdm list command with new formats: --csv,--markdown and add options --fields,--sort to control the output contents. Users can also include
    licenses in the --fields option to display the package licenses. #1469
  * A new pre-commit hook to run pdm lock --check in pre-commit. #1471
  Bug Fixes#
  * Fix the issue that relative paths don't work well with --project argument. #1220
  * It is now possible to refer to a package from outside the project with relative paths in dependencies. #1381
  * Ensure pypi.[ca,client]_cert[s] config items are passed to distribution builder install steps to allow for custom PyPI index sources with
    self signed certificates. #1396
  * Fix a crash issue when depending on editable packages with extras. #1401
  * Do not save the python path when using non-interactive mode in pdm init. #1410
  * Fix the matching of python* command in pdm run. #1414
  * Show the Python path, instead of the real executable, in the Python selection menu. #1418
  * Fix the HTTP client of package publishment to prompt for password and read PDM configurations correctly. #1430
  * Ignore the unknown fields when constructing a requirement object. #1445
  * Fix a bug of unrelated candidates being fetched if the requirement is matching wildcard versions(e.g. ==1.*). #1465
  * Use importlib-metadata from PyPI for Python < 3.10. #1467
  Documentation#
  * Clarify the difference between a library and an application. Update the guide of multi-stage docker build. #1371
  * Removals and Deprecations#
  * Remove all top-level imports, users should import from the submodules instead. #1404
  * Remove the usages of old config names deprecated since 2.0. #1422
  * Remove the deprecated color functions, use rich's console markup instead. #1452

OBS-URL: https://build.opensuse.org/request/show/1036217
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pdm?expand=0&rev=6
This commit is contained in:
Dominique Leuenberger 2022-11-16 14:43:28 +00:00 committed by Git OBS Bridge
commit 116d52dc4a
5 changed files with 163 additions and 5 deletions

100
findpython-022.patch Normal file
View File

@ -0,0 +1,100 @@
From f8ec8b7bda1b88e60b554b5713ca615c9bf94367 Mon Sep 17 00:00:00 2001
From: Frost Ming <mianghong@gmail.com>
Date: Wed, 16 Nov 2022 09:25:21 +0800
Subject: [PATCH] fix: test against the latest findpython
---
news/1516.bugfix.md | 1 +
src/pdm/cli/actions.py | 16 +++++-----------
src/pdm/models/python.py | 11 +++++++----
tests/cli/test_use.py | 4 ++--
4 files changed, 15 insertions(+), 17 deletions(-)
create mode 100644 news/1516.bugfix.md
--- /dev/null
+++ b/news/1516.bugfix.md
@@ -0,0 +1 @@
+Fix the test failure with the latest `findpython` installed.
--- a/src/pdm/cli/actions.py
+++ b/src/pdm/cli/actions.py
@@ -31,12 +31,7 @@ from pdm.cli.utils import (
set_env_in_reg,
translate_groups,
)
-from pdm.exceptions import (
- InvalidPyVersion,
- NoPythonVersion,
- PdmUsageError,
- ProjectError,
-)
+from pdm.exceptions import NoPythonVersion, PdmUsageError, ProjectError
from pdm.formats import FORMATS
from pdm.formats.base import array_of_inline_tables, make_array, make_inline_table
from pdm.models.caches import JSONFileCache
@@ -584,8 +579,10 @@ def do_use(
python = python.strip()
def version_matcher(py_version: PythonInfo) -> bool:
- return ignore_requires_python or project.python_requires.contains(
- str(py_version.version), True
+ return (
+ ignore_requires_python
+ or py_version.valid
+ and project.python_requires.contains(str(py_version.version), True)
)
if not project.cache_dir.exists():
@@ -647,9 +644,6 @@ def do_use(
if python:
use_cache.set(python, selected_python.path.as_posix())
- if not selected_python.valid:
- path = str(selected_python.path)
- raise InvalidPyVersion(f"Invalid Python interpreter: {path}")
if not save:
return selected_python
old_python = (
--- a/src/pdm/models/python.py
+++ b/src/pdm/models/python.py
@@ -5,7 +5,7 @@ from pathlib import Path
from typing import Any
from findpython import PythonVersion
-from packaging.version import Version
+from packaging.version import InvalidVersion, Version
from pdm.utils import cached_property
@@ -72,6 +72,9 @@ class PythonInfo:
@property
def identifier(self) -> str:
- if os.name == "nt" and self.is_32bit:
- return f"{self.major}.{self.minor}-32"
- return f"{self.major}.{self.minor}"
+ try:
+ if os.name == "nt" and self.is_32bit:
+ return f"{self.major}.{self.minor}-32"
+ return f"{self.major}.{self.minor}"
+ except InvalidVersion:
+ return "unknown"
--- a/tests/cli/test_use.py
+++ b/tests/cli/test_use.py
@@ -6,7 +6,7 @@ from pathlib import Path
import pytest
from pdm.cli import actions
-from pdm.exceptions import InvalidPyVersion
+from pdm.exceptions import NoPythonVersion
from pdm.models.caches import JSONFileCache
@@ -56,7 +56,7 @@ echo hello
shim_path = project.root.joinpath("python_shim.sh")
shim_path.write_text(wrapper_script)
shim_path.chmod(0o755)
- with pytest.raises(InvalidPyVersion):
+ with pytest.raises(NoPythonVersion):
actions.do_use(project, shim_path.as_posix())

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5bee41d497cec93a49693fa57b5cf1c833701804eb12bc4d347c3ec7955d7ce7
size 3282155

3
pdm-2.2.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a861d47d57bc6ef9e99edb09abd620955a37b2835019b6a8918beea3b089a3b7
size 2770967

View File

@ -1,3 +1,58 @@
-------------------------------------------------------------------
Wed Nov 16 08:58:23 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add findpython-022.patch to make package work with findpython
0.2.2 (from gh#pdm-project/pdm#1516).
-------------------------------------------------------------------
Tue Nov 15 19:09:33 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Skip failing test (gh#pdm-project/pdm#1516).
-------------------------------------------------------------------
Wed Nov 9 16:22:05 UTC 2022 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to v2.2.1
Features & Improvements#
* Make sitecustomize.py respect the PDM_PROJECT_MAX_DEPTH environment variable #1471
Bug Fixes#
* Fix the comparison of python_version in the environment marker. When the version contains only one digit, the result was incorrect. #1484
- Update to v2.2.0
Features & Improvements#
* Add venv.prompt configuration to allow customizing prompt when a virtualenv is activated #1332
* Allow the use of custom CA certificates per publish repository using ca_certs or from the command line via pdm publish --ca-certs <path> .... #1392
* Rename the plugin command to self, and it can not only manage plugins but also all dependencies. Add a subcommand self update to update PDM itself. #1406
* Allow pdm init to receive a Python path or version via --python option. #1412
* Add a default value for requires-python when importing from other formats. #1426
* Use pdm instead of pip to resolve and install build requirements. So that PDM configurations can control the process. #1429
* Customizable color theme via pdm config command. #1450
* A new pdm lock --check flag to validate whether the lock is up to date. #1459
* Add both option and config item to ship pip when creating a new venv. #1463
* Issue warning and skip the requirement if it has the same name as the current project. #1466
* Enhance the pdm list command with new formats: --csv,--markdown and add options --fields,--sort to control the output contents. Users can also include
licenses in the --fields option to display the package licenses. #1469
* A new pre-commit hook to run pdm lock --check in pre-commit. #1471
Bug Fixes#
* Fix the issue that relative paths don't work well with --project argument. #1220
* It is now possible to refer to a package from outside the project with relative paths in dependencies. #1381
* Ensure pypi.[ca,client]_cert[s] config items are passed to distribution builder install steps to allow for custom PyPI index sources with
self signed certificates. #1396
* Fix a crash issue when depending on editable packages with extras. #1401
* Do not save the python path when using non-interactive mode in pdm init. #1410
* Fix the matching of python* command in pdm run. #1414
* Show the Python path, instead of the real executable, in the Python selection menu. #1418
* Fix the HTTP client of package publishment to prompt for password and read PDM configurations correctly. #1430
* Ignore the unknown fields when constructing a requirement object. #1445
* Fix a bug of unrelated candidates being fetched if the requirement is matching wildcard versions(e.g. ==1.*). #1465
* Use importlib-metadata from PyPI for Python < 3.10. #1467
Documentation#
* Clarify the difference between a library and an application. Update the guide of multi-stage docker build. #1371
* Removals and Deprecations#
* Remove all top-level imports, users should import from the submodules instead. #1404
* Remove the usages of old config names deprecated since 2.0. #1422
* Remove the deprecated color functions, use rich's console markup instead. #1452
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Oct 5 09:47:36 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com> Wed Oct 5 09:47:36 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>

View File

@ -26,12 +26,15 @@
%bcond_with test %bcond_with test
%endif %endif
Name: python-pdm%{psuffix} Name: python-pdm%{psuffix}
Version: 2.1.5 Version: 2.2.1
Release: 0 Release: 0
Summary: Python Development Master Summary: Python Development Master
License: MIT License: MIT
URL: https://github.com/pdm-project/pdm/ URL: https://github.com/pdm-project/pdm/
Source0: https://files.pythonhosted.org/packages/source/p/pdm/pdm-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/p/pdm/pdm-%{version}.tar.gz
# PATCH-FIX-UPSTREAM findpython-022.patch gh#pdm-project/pdm#1516 mcepl@suse.com
# Makes the module work with findpython 0.2.2
Patch0: findpython-022.patch
BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pdm-pep517 >= 1.0} BuildRequires: %{python_module pdm-pep517 >= 1.0}
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
@ -40,7 +43,7 @@ BuildRequires: python-rpm-macros
Requires: python-blinker Requires: python-blinker
Requires: python-cachecontrol >= 0.12.11 Requires: python-cachecontrol >= 0.12.11
Requires: python-certifi Requires: python-certifi
Requires: python-findpython >= 0.2.0 Requires: python-findpython >= 0.2.2
Requires: python-packaging >= 20.9 Requires: python-packaging >= 20.9
Requires: python-pep517 >= 0.11.0 Requires: python-pep517 >= 0.11.0
Requires: python-platformdirs Requires: python-platformdirs