Skip to content

Commit ee7d0ce

Browse files
authored
Set PIP_* env vars for outputs/script (#5368)
* Set PIP_* env vars for outputs/script * Add test * add news
1 parent 4457362 commit ee7d0ce

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

conda_build/build.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,7 @@ def bundle_conda(
17751775
env_output["RECIPE_DIR"] = metadata.path
17761776
env_output["MSYS2_PATH_TYPE"] = "inherit"
17771777
env_output["CHERE_INVOKING"] = "1"
1778+
_set_env_variables_for_build(metadata, env_output)
17781779
for var in utils.ensure_list(metadata.get_value("build/script_env")):
17791780
if "=" in var:
17801781
val = var.split("=", 1)[1]
@@ -3060,13 +3061,7 @@ def construct_metadata_for_test(recipedir_or_package, config):
30603061
return m, hash_input
30613062

30623063

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

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

3096+
3097+
def write_build_scripts(m, script, build_file):
3098+
# TODO: Prepending the prefixes here should probably be guarded by
3099+
# if not m.activate_build_script:
3100+
# Leaving it as is, for now, since we need a quick, non-disruptive patch release.
3101+
with utils.path_prepended(m.config.host_prefix, False):
3102+
with utils.path_prepended(m.config.build_prefix, False):
3103+
env = environ.get_dict(m=m)
3104+
3105+
_set_env_variables_for_build(m, env)
3106+
31013107
work_file = join(m.config.work_dir, "conda_build.sh")
31023108
env_file = join(m.config.work_dir, "build_env_setup.sh")
31033109
with open(env_file, "w") as bf:

news/5368-pip-outputs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Enhancements
2+
3+
* PIP_* env variables are set when building outputs in multi-output recipes. (#3993 via #5368)
4+
5+
### Bug fixes
6+
7+
* <news item>
8+
9+
### Deprecations
10+
11+
* <news item>
12+
13+
### Docs
14+
15+
* <news item>
16+
17+
### Other
18+
19+
* <news item>

tests/test-recipes/split-packages/script_install_files/subpackage1.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

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

5+
assert "PIP_NO_INDEX" in os.environ
6+
57
with open(out_path, 'w') as f:
68
f.write("weeee")
79

0 commit comments

Comments
 (0)