Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: python_site_packages_path can be specified in the build section #5502

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions docs/source/resources/define-metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------
Expand Down
Original file line number Diff line number Diff line change
@@ -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

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package:
name: python
version: 3.99.99

build:
python_site_packages_path: "some/path"
9 changes: 9 additions & 0 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
Loading