diff --git a/conda_build/build.py b/conda_build/build.py index 42fe0d5c21..9bce326305 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -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] @@ -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 @@ -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: diff --git a/news/5368-pip-outputs b/news/5368-pip-outputs new file mode 100644 index 0000000000..ce2e6bb0f2 --- /dev/null +++ b/news/5368-pip-outputs @@ -0,0 +1,19 @@ +### Enhancements + +* PIP_* env variables are set when building outputs in multi-output recipes. (#3993 via #5368) + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* + +### Other + +* diff --git a/tests/test-recipes/split-packages/script_install_files/subpackage1.py b/tests/test-recipes/split-packages/script_install_files/subpackage1.py index 22cf26111b..2f64db8201 100644 --- a/tests/test-recipes/split-packages/script_install_files/subpackage1.py +++ b/tests/test-recipes/split-packages/script_install_files/subpackage1.py @@ -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")