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

Set PIP_* env vars for outputs/script #5368

Merged
merged 3 commits into from
Jun 21, 2024
Merged
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
20 changes: 13 additions & 7 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1775,6 +1775,7 @@ def bundle_conda(
env_output["RECIPE_DIR"] = metadata.path
env_output["MSYS2_PATH_TYPE"] = "inherit"
env_output["CHERE_INVOKING"] = "1"
_set_env_variables_for_build(metadata, env_output)
for var in utils.ensure_list(metadata.get_value("build/script_env")):
if "=" in var:
val = var.split("=", 1)[1]
Expand Down Expand Up @@ -3060,13 +3061,7 @@ def construct_metadata_for_test(recipedir_or_package, config):
return m, hash_input


def write_build_scripts(m, script, build_file):
# TODO: Prepending the prefixes here should probably be guarded by
# if not m.activate_build_script:
# Leaving it as is, for now, since we need a quick, non-disruptive patch release.
with utils.path_prepended(m.config.host_prefix, False):
with utils.path_prepended(m.config.build_prefix, False):
env = environ.get_dict(m=m)
def _set_env_variables_for_build(m, env):
env["CONDA_BUILD_STATE"] = "BUILD"

# hard-code this because we never want pip's build isolation
Expand Down Expand Up @@ -3098,6 +3093,17 @@ def write_build_scripts(m, script, build_file):
if "replacements" in env:
del env["replacements"]


def write_build_scripts(m, script, build_file):
# TODO: Prepending the prefixes here should probably be guarded by
# if not m.activate_build_script:
# Leaving it as is, for now, since we need a quick, non-disruptive patch release.
with utils.path_prepended(m.config.host_prefix, False):
with utils.path_prepended(m.config.build_prefix, False):
env = environ.get_dict(m=m)

_set_env_variables_for_build(m, env)

work_file = join(m.config.work_dir, "conda_build.sh")
env_file = join(m.config.work_dir, "build_env_setup.sh")
with open(env_file, "w") as bf:
Expand Down
19 changes: 19 additions & 0 deletions news/5368-pip-outputs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* PIP_* env variables are set when building outputs in multi-output recipes. (#3993 via #5368)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

out_path = os.path.join(os.environ['PREFIX'], 'subpackage_file_1')

assert "PIP_NO_INDEX" in os.environ

with open(out_path, 'w') as f:
f.write("weeee")

Expand Down