From 0481de230ab05cadc48a5ea68eb9bbe18b381c63 Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Mon, 9 Sep 2024 15:22:49 -0500 Subject: [PATCH 1/4] include python_site_packages_path in index.json --- conda_build/metadata.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conda_build/metadata.py b/conda_build/metadata.py index b744a8b3c9..6564a2b526 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -635,6 +635,7 @@ def parse(data, config, path=None): "error_overdepending": None, "error_overlinking": None, "overlinking_ignore_patterns": [], + "python_site_packages_path": str, }, "outputs": { "name": None, @@ -1807,6 +1808,8 @@ def info_index(self): d["provides_features"] = self.get_value("build/provides_features") if self.get_value("build/requires_features"): d["requires_features"] = self.get_value("build/requires_features") + if self.get_value("build/python_site_packages_path"): + d["python_site_packages_path"] = self.get_value("build/python_site_packages_path") if self.noarch: d["platform"] = d["arch"] = None d["subdir"] = "noarch" From 5af3780b6a81abefdf77bfc1e053a97bbf8c7bad Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Fri, 20 Sep 2024 14:08:15 -0500 Subject: [PATCH 2/4] TST: test for python_site_packages_path metadata --- .../metadata/_python_site_packages_path/meta.yaml | 6 ++++++ tests/test_api_build.py | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/test-recipes/metadata/_python_site_packages_path/meta.yaml diff --git a/tests/test-recipes/metadata/_python_site_packages_path/meta.yaml b/tests/test-recipes/metadata/_python_site_packages_path/meta.yaml new file mode 100644 index 0000000000..2c38618aa1 --- /dev/null +++ b/tests/test-recipes/metadata/_python_site_packages_path/meta.yaml @@ -0,0 +1,6 @@ +package: + name: python + version: 3.99.99 + +build: + python_site_packages_path: "some/path" diff --git a/tests/test_api_build.py b/tests/test_api_build.py index efba89d75d..bd980d44c2 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -1703,6 +1703,15 @@ def test_provides_features_metadata(testing_config): assert index["provides_features"] == {"test2": "also_ok"} +@pytest.mark.sanity +def test_python_site_packages_path(testing_config): + recipe = os.path.join(metadata_dir, "_python_site_packages_path") + out = api.build(recipe, config=testing_config)[0] + index = json.loads(package_has_file(out, "info/index.json")) + assert "python_site_packages_path" in index + assert index["python_site_packages_path"] == "some/path" + + def test_overlinking_detection( testing_config, testing_workdir, variants_conda_build_sysroot ): From 73ecc5eff8950b0c42ed92330eeb54c1bca6fc27 Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Fri, 20 Sep 2024 14:15:39 -0500 Subject: [PATCH 3/4] DOC: document python_site_packages_path --- docs/source/resources/define-metadata.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/source/resources/define-metadata.rst b/docs/source/resources/define-metadata.rst index d7b5e9ff70..a791e320bb 100644 --- a/docs/source/resources/define-metadata.rst +++ b/docs/source/resources/define-metadata.rst @@ -373,6 +373,19 @@ Python in macOS. The default is ``False``. build: osx_is_app: True +python_site_packages_path +------------------------- + +Packages with a name of ``python`` can optionally specify the location of the +site-packages directory relative to the root of the environment with +``python_site_packages_path``. This should only be used in ``python`` packages +and only when the path is not the CPython default. + +.. code-block:: yaml + + build: + python_site_packages_path: lib/python3.13t/site-packages + Track features -------------- From 4c34611455ec5f00795a262461fe1430e08e3bd4 Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Fri, 20 Sep 2024 14:26:31 -0500 Subject: [PATCH 4/4] add news item --- ...path-can-be-specified-in-the-build-section | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 news/5502-python_site_packages_path-can-be-specified-in-the-build-section diff --git a/news/5502-python_site_packages_path-can-be-specified-in-the-build-section b/news/5502-python_site_packages_path-can-be-specified-in-the-build-section new file mode 100644 index 0000000000..5243215586 --- /dev/null +++ b/news/5502-python_site_packages_path-can-be-specified-in-the-build-section @@ -0,0 +1,19 @@ +### Enhancements + +* The location of the site-packages directory can be specified in `python_site_packages_path` in the build section of a recipe (#5502). + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* + +### Other + +*