From 8c3fb499c7c6c287a547059a38a5c0eb77aed2d47e3ec8a558ee1494bf34fb72 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 2 May 2025 15:27:11 +0000 Subject: [PATCH] Accepting request 1273997 from home:mcalabkova:branches:devel:languages:python - Update to 1.9.0 * Add an --all-groups option to export dependencies from all groups * Drop support for Python 3.8 * Clarify the help text of --with and --only and deprecate --without * Fail if the poetry.lock file is not consistent with the pyproject.toml file * Fix an issue where the export failed with the message "dependency walk failed". This fix requires a poetry.lock file created with Poetry 2.x * Fix an issue where the pre-commit hook regex matched wrong files - Add upstream tests.patch to fix tests with recent poetry OBS-URL: https://build.opensuse.org/request/show/1273997 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-poetry-plugin-export?expand=0&rev=21 --- poetry_plugin_export-1.8.0.tar.gz | 3 - poetry_plugin_export-1.9.0.tar.gz | 3 + python-poetry-plugin-export.changes | 14 +++ python-poetry-plugin-export.spec | 8 +- tests.patch | 141 ++++++++++++++++++++++++++++ 5 files changed, 163 insertions(+), 6 deletions(-) delete mode 100644 poetry_plugin_export-1.8.0.tar.gz create mode 100644 poetry_plugin_export-1.9.0.tar.gz create mode 100644 tests.patch diff --git a/poetry_plugin_export-1.8.0.tar.gz b/poetry_plugin_export-1.8.0.tar.gz deleted file mode 100644 index 03f8727..0000000 --- a/poetry_plugin_export-1.8.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1fa6168a85d59395d835ca564bc19862a7c76061e60c3e7dfaec70d50937fc61 -size 29840 diff --git a/poetry_plugin_export-1.9.0.tar.gz b/poetry_plugin_export-1.9.0.tar.gz new file mode 100644 index 0000000..12c3a05 --- /dev/null +++ b/poetry_plugin_export-1.9.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fc8755cfac93c74752f85510b171983e2e47d782d4ab5be4ffc4f6945be7967 +size 30835 diff --git a/python-poetry-plugin-export.changes b/python-poetry-plugin-export.changes index 2582065..ac4ad7f 100644 --- a/python-poetry-plugin-export.changes +++ b/python-poetry-plugin-export.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Fri May 2 11:26:45 UTC 2025 - Markéta Machová + +- Update to 1.9.0 + * Add an --all-groups option to export dependencies from all groups + * Drop support for Python 3.8 + * Clarify the help text of --with and --only and deprecate --without + * Fail if the poetry.lock file is not consistent with the pyproject.toml + file + * Fix an issue where the export failed with the message "dependency walk + failed". This fix requires a poetry.lock file created with Poetry 2.x + * Fix an issue where the pre-commit hook regex matched wrong files +- Add upstream tests.patch to fix tests with recent poetry + ------------------------------------------------------------------- Mon Nov 4 19:08:14 UTC 2024 - Ben Greiner diff --git a/python-poetry-plugin-export.spec b/python-poetry-plugin-export.spec index 5d0b3ec..ce44f03 100644 --- a/python-poetry-plugin-export.spec +++ b/python-poetry-plugin-export.spec @@ -1,7 +1,7 @@ # # spec file for package python-poetry-plugin-export # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,13 +27,15 @@ %{?sle15_python_module_pythons} Name: python-poetry-plugin-export%{psuffix} -Version: 1.8.0 +Version: 1.9.0 Release: 0 Summary: Poetry plugin to export the dependencies to various formats License: MIT URL: https://python-poetry.org/ # RepositorySource: https://github.com/python-poetry/poetry-plugin-export Source: https://files.pythonhosted.org/packages/source/p/poetry-plugin-export/poetry_plugin_export-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/python-poetry/poetry-plugin-export/pull/321 tests: adapt tests to cosmetic changes caused by poetry-core#826 +Patch: tests.patch BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pip} BuildRequires: %{python_module poetry-core >= 1.7.0 with %python-poetry-core < 3} @@ -58,7 +60,7 @@ BuildArch: noarch Poetry plugin to export the dependencies to various formats %prep -%setup -q -n poetry_plugin_export-%{version} +%autosetup -p1 -n poetry_plugin_export-%{version} %if !%{with test} %build diff --git a/tests.patch b/tests.patch new file mode 100644 index 0000000..7928853 --- /dev/null +++ b/tests.patch @@ -0,0 +1,141 @@ +From 16637f194e86708913ec6e09064c713eb0715bb6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Randy=20D=C3=B6ring?= + <30527984+radoering@users.noreply.github.com> +Date: Sat, 25 Jan 2025 13:02:47 +0100 +Subject: [PATCH] tests: adapt tests to cosmetic changes caused by + poetry-core#826 + +--- + poetry.lock | 107 ++++++++++++++++++++++++++++++++++++----- + pyproject.toml | 3 +- + tests/markers.py | 10 ++-- + tests/test_exporter.py | 16 +++--- + 4 files changed, 112 insertions(+), 24 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 4c6c1be..fb242c2 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -19,7 +19,8 @@ include = [ + [tool.poetry.dependencies] + python = "^3.9" + poetry = ">=2.0.0,<3.0.0" +-poetry-core = ">=1.7.0,<3.0.0" ++# poetry-core = ">=1.7.0,<3.0.0" ++poetry-core = { git = "git+https://github.com/python-poetry/poetry-core.git" } + + [tool.poetry.group.dev.dependencies] + pre-commit = ">=2.18" +diff --git a/tests/markers.py b/tests/markers.py +index 8f23c3b..a8ab8bc 100644 +--- a/tests/markers.py ++++ b/tests/markers.py +@@ -1,5 +1,6 @@ + from __future__ import annotations + ++from poetry.core.version.markers import MarkerUnion + from poetry.core.version.markers import parse_marker + + +@@ -10,21 +11,24 @@ + + MARKER_CPYTHON = parse_marker('implementation_name == "cpython"') + +-MARKER_PY27 = parse_marker('python_version >= "2.7" and python_version < "2.8"') ++MARKER_PY27 = parse_marker('python_version == "2.7"') + + MARKER_PY36 = parse_marker('python_version >= "3.6" and python_version < "4.0"') + MARKER_PY36_38 = parse_marker('python_version >= "3.6" and python_version < "3.8"') + MARKER_PY36_PY362 = parse_marker( + 'python_version >= "3.6" and python_full_version < "3.6.2"' + ) ++MARKER_PY36_PY362_ALT = parse_marker( ++ 'python_full_version < "3.6.2" and python_version == "3.6"' ++) + MARKER_PY362_PY40 = parse_marker( + 'python_full_version >= "3.6.2" and python_version < "4.0"' + ) +-MARKER_PY36_ONLY = parse_marker('python_version >= "3.6" and python_version < "3.7"') ++MARKER_PY36_ONLY = parse_marker('python_version == "3.6"') + + MARKER_PY37 = parse_marker('python_version >= "3.7" and python_version < "4.0"') + +-MARKER_PY = MARKER_PY27.union(MARKER_PY36) ++MARKER_PY = MarkerUnion(MARKER_PY27, MARKER_PY36) + + MARKER_PY_WIN32 = MARKER_PY.intersect(MARKER_WIN32) + MARKER_PY_WINDOWS = MARKER_PY.intersect(MARKER_WINDOWS) +diff --git a/tests/test_exporter.py b/tests/test_exporter.py +index e46e5ca..d2fbb74 100644 +--- a/tests/test_exporter.py ++++ b/tests/test_exporter.py +@@ -10,6 +10,7 @@ + from poetry.core.constraints.version import Version + from poetry.core.packages.dependency import Dependency + from poetry.core.packages.dependency_group import MAIN_GROUP ++from poetry.core.version.markers import MarkerUnion + from poetry.core.version.markers import parse_marker + from poetry.factory import Factory + from poetry.packages import Locker as BaseLocker +@@ -27,6 +28,7 @@ + from tests.markers import MARKER_PY36_38 + from tests.markers import MARKER_PY36_ONLY + from tests.markers import MARKER_PY36_PY362 ++from tests.markers import MARKER_PY36_PY362_ALT + from tests.markers import MARKER_PY37 + from tests.markers import MARKER_PY362_PY40 + from tests.markers import MARKER_PY_DARWIN +@@ -212,7 +214,7 @@ def test_exporter_can_export_requirements_txt_with_standard_packages_and_markers + expected = f"""\ + bar==4.5.6 ; {MARKER_PY} + baz==7.8.9 ; {MARKER_PY_WIN32} +-foo==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_ONLY)} ++foo==1.2.3 ; {MarkerUnion(MARKER_PY27, MARKER_PY36_ONLY)} + """ + + assert content == expected +@@ -495,7 +497,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers( + with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: + content = f.read() + +- marker_py = MARKER_PY27.union(MARKER_PY36_ONLY) ++ marker_py = MarkerUnion(MARKER_PY27, MARKER_PY36_ONLY) + marker_py_win32 = marker_py.intersect(MARKER_WIN32) + marker_py_windows = marker_py.intersect(MARKER_WINDOWS) + +@@ -523,12 +525,12 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers( + [ + ( + False, +- [f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38)}"], ++ [f"a==1.2.3 ; {MarkerUnion(MARKER_PY27, MARKER_PY36_38)}"], + ), + ( + True, + [ +- f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38).union(MARKER_PY36)}", ++ f"a==1.2.3 ; {MarkerUnion(MARKER_PY27, MARKER_PY36_38.union(MARKER_PY36))}", + f"b==4.5.6 ; {MARKER_PY}", + ], + ), +@@ -2304,7 +2306,7 @@ def test_exporter_doesnt_confuse_repeated_packages( + expected = f"""\ + celery==5.1.2 ; {MARKER_PY36_ONLY} + celery==5.2.3 ; {MARKER_PY37} +-click-didyoumean==0.0.3 ; {MARKER_PY36_PY362} ++click-didyoumean==0.0.3 ; {MARKER_PY36_PY362 if lock_version == "2.1" else MARKER_PY36_PY362_ALT} + click-didyoumean==0.3.0 ; {MARKER_PY362_PY40} + click-plugins==1.1.1 ; {MARKER_PY36} + click==7.1.2 ; {MARKER_PY36_ONLY} +@@ -3272,9 +3274,9 @@ def test_dependency_walk_error( + content = f.read() + + expected = """\ +-bar==1 ; python_version >= "3.8" and python_version < "3.9" ++bar==1 ; python_version == "3.8" + bar==2 ; python_version >= "3.9" and python_version < "4.0" +-foo==1 ; python_version >= "3.8" and python_version < "3.9" ++foo==1 ; python_version == "3.8" + foo==2 ; python_version >= "3.9" and python_version < "4.0" + """ +