From d323bc91dd0d47b8f6f9874fbda559e4f0987e52 Mon Sep 17 00:00:00 2001 From: Imani Pelton Date: Wed, 5 Feb 2025 13:52:40 -0500 Subject: [PATCH 1/5] fix: don't require a specific python interpreter for uv (#1003) --- craft_parts/plugins/uv_plugin.py | 8 +++++++- tests/integration/plugins/test_uv.py | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/craft_parts/plugins/uv_plugin.py b/craft_parts/plugins/uv_plugin.py index db6530711..f64456e80 100644 --- a/craft_parts/plugins/uv_plugin.py +++ b/craft_parts/plugins/uv_plugin.py @@ -98,8 +98,14 @@ def _get_rewrite_shebangs_commands(self) -> list[str]: return [] def _get_create_venv_commands(self) -> list[str]: + # Explicitly request a Python version if provided by the plugin, otherwise use the global + # parts interpreter. + python_ver = ( + self._get_system_python_interpreter() + or "$(which ${PARTS_PYTHON_INTERPRETER})" + ) return [ - f'uv venv --relocatable --allow-existing --python "{self._get_system_python_interpreter()}" "{self._get_venv_directory()}"', + f'uv venv --relocatable --allow-existing --python {python_ver} "{self._get_venv_directory()}"', f'PARTS_PYTHON_VENV_INTERP_PATH="{self._get_venv_directory()}/bin/${{PARTS_PYTHON_INTERPRETER}}"', ] diff --git a/tests/integration/plugins/test_uv.py b/tests/integration/plugins/test_uv.py index 2e5501744..10446afd8 100644 --- a/tests/integration/plugins/test_uv.py +++ b/tests/integration/plugins/test_uv.py @@ -148,9 +148,11 @@ def _should_remove_symlinks(self) -> bool: ) actions = lf.plan(Step.PRIME) - with lf.action_executor() as ctx, pytest.raises(errors.PluginBuildError): + with lf.action_executor() as ctx, pytest.raises(errors.PluginBuildError) as exc: ctx.execute(actions) + assert b"No suitable Python interpreter found" in cast(bytes, exc.value.stderr) + def test_uv_plugin_remove_symlinks(new_dir, partitions, uv_parts_simple): """Override symlink removal.""" From 50af1b91f3b2805591f1ef78f571f75672ff8daa Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Fri, 24 Jan 2025 14:08:24 -0500 Subject: [PATCH 2/5] fix(tests): don't fail if you have additional JREs (#986) Fixes #985 --- tests/unit/plugins/test_java_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/plugins/test_java_plugin.py b/tests/unit/plugins/test_java_plugin.py index dd9a46010..979919ef5 100644 --- a/tests/unit/plugins/test_java_plugin.py +++ b/tests/unit/plugins/test_java_plugin.py @@ -43,12 +43,12 @@ def _check_java(self, javac: str): assert plugin.get_build_environment() == {} -def test_java_plugin_jre_21(part_info, mocker): +def test_java_plugin_jre_not_17(part_info, mocker): orig_check_java = JavaPlugin._check_java def _check_java(self, javac: str): - if "21" in javac: + if "17" not in javac: return None, "" return orig_check_java(self, javac) From 34856e09a89e7d6bccf4245689205e96b800de40 Mon Sep 17 00:00:00 2001 From: Callahan Kovacs Date: Fri, 7 Feb 2025 11:35:38 -0600 Subject: [PATCH 3/5] style: black Signed-off-by: Callahan Kovacs --- craft_parts/sources/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/craft_parts/sources/__init__.py b/craft_parts/sources/__init__.py index 90052e467..62592937e 100644 --- a/craft_parts/sources/__init__.py +++ b/craft_parts/sources/__init__.py @@ -41,7 +41,7 @@ def _detect_source_type( - data: SourceModel | dict[str, Any] + data: SourceModel | dict[str, Any], ) -> SourceModel | dict[str, Any]: """Get the source type for a source if it's not already provided.""" if isinstance(data, BaseSourceModel) or "source-type" in data: From 00df55d1343b049f3326a27a2ec80b9178605bbc Mon Sep 17 00:00:00 2001 From: Callahan Kovacs Date: Fri, 7 Feb 2025 11:45:49 -0600 Subject: [PATCH 4/5] ci(docs): ignore crates.io urls Signed-off-by: Callahan Kovacs --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index a7dbdf89a..7cfe114a2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -74,6 +74,8 @@ "https://foo.org/", # GNU's site is a bit unreliable "https://www.gnu.org/.*", + # https://github.com/rust-lang/crates.io/issues/788 + "https://crates.io/", # Ignore releases, since we'll include the next release before it exists. "https://github.com/canonical/[a-z]*craft[a-z-]*/releases/.*", ] From 4a25c83233e80d2cfc9b3eb83fc1f07f7adb142c Mon Sep 17 00:00:00 2001 From: Callahan Kovacs Date: Fri, 7 Feb 2025 11:29:21 -0600 Subject: [PATCH 5/5] docs(changelog): add 2.3.1 entry Signed-off-by: Callahan Kovacs --- docs/reference/changelog.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/reference/changelog.rst b/docs/reference/changelog.rst index 3596b88da..3546d4072 100644 --- a/docs/reference/changelog.rst +++ b/docs/reference/changelog.rst @@ -2,6 +2,16 @@ Changelog ********* +2.3.1 (2025-02-07) +------------------ + +Bug fixes: + +- Allow for a non-specific system Python interpreter when using the + :ref:`uv plugin`. + +For a complete list of commits, check out the `2.3.1`_ release on GitHub. + 2.3.0 (2025-01-20) ------------------ @@ -708,6 +718,7 @@ For a complete list of commits, check out the `2.0.0`_ release on GitHub. .. _craft-cli issue #172: https://github.com/canonical/craft-cli/issues/172 .. _Poetry: https://python-poetry.org +.. _2.3.1: https://github.com/canonical/craft-parts/releases/tag/2.3.1 .. _2.2.0: https://github.com/canonical/craft-parts/releases/tag/2.2.0 .. _2.1.4: https://github.com/canonical/craft-parts/releases/tag/2.1.4 .. _2.1.3: https://github.com/canonical/craft-parts/releases/tag/2.1.3