Skip to content

Commit 7773c02

Browse files
committed
Revert "fix: ensure we parse recipes with config files"
This reverts commit 298118b.
1 parent 298118b commit 7773c02

File tree

3 files changed

+24
-52
lines changed

3 files changed

+24
-52
lines changed

conda_forge_tick/provide_source_code.py

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -195,29 +195,17 @@ def _print_out():
195195

196196

197197
def _provide_source_code_v1(recipe_dir, variant_config_file):
198-
199-
var_cfg_files = []
200-
global_cbc_pth = os.path.join(os.environ["CONDA_PREFIX"], "conda_build_config.yaml")
201-
202-
if os.path.exists(global_cbc_pth):
203-
var_cfg_files.append(global_cbc_pth)
204-
205-
if os.path.exists(f"{recipe_dir}/conda_build_config.yaml"):
206-
var_cfg_files.append(f"{recipe_dir}/conda_build_config.yaml")
207-
208-
var_cfg_files.append(variant_config_file)
209-
210-
cmd = [
211-
"rattler-build",
212-
"build",
213-
"--render-only",
214-
"-r",
215-
f"{recipe_dir}/recipe.yaml",
216-
]
217-
for cfg in var_cfg_files:
218-
cmd += ["-m", cfg]
219-
220-
recipe_json = subprocess.check_output(cmd)
198+
recipe_json = subprocess.check_output(
199+
[
200+
"rattler-build",
201+
"build",
202+
"--render-only",
203+
"-r",
204+
f"{recipe_dir}/recipe.yaml",
205+
"-m",
206+
variant_config_file,
207+
]
208+
)
221209
recipe_meta = json.loads(recipe_json)[0]
222210
recipe = recipe_meta["recipe"]
223211
minimal_recipe = {
@@ -233,17 +221,15 @@ def _provide_source_code_v1(recipe_dir, variant_config_file):
233221
with open(f"{recipe_dir}/minimal_recipe.yaml", "w") as f:
234222
yaml.dump(minimal_recipe, f)
235223
try:
236-
cmd = [
237-
"rattler-build",
238-
"build",
239-
"-r",
240-
f"{recipe_dir}/minimal_recipe.yaml",
241-
]
242-
for cfg in var_cfg_files:
243-
cmd += ["-m", cfg]
244-
245224
out = subprocess.run(
246-
cmd,
225+
[
226+
"rattler-build",
227+
"build",
228+
"-r",
229+
f"{recipe_dir}/minimal_recipe.yaml",
230+
"-m",
231+
variant_config_file,
232+
],
247233
check=False,
248234
capture_output=True,
249235
)

conda_forge_tick/update_sources.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
import functools
55
import json
66
import logging
7-
import os
87
import re
98
import subprocess
10-
import tempfile
119
import typing
1210
import urllib.parse
1311
import urllib.request
@@ -618,14 +616,7 @@ def get_url(self, node_attrs: AttrsTypedDict) -> str | None:
618616
else:
619617
new_content = content.replace(orig_ver, next_ver)
620618
if node_attrs["meta_yaml"].get("schema_version", 0) == 0:
621-
if cbc_data is not None:
622-
with tempfile.TemporaryDirectory() as tmpdir:
623-
cbc_pth = os.path.join(tmpdir, "conda_build_config.yaml")
624-
with open(cbc_pth, "w") as fp:
625-
fp.write(cbc_data)
626-
new_meta = parse_meta_yaml(new_content, cbc_path=cbc_pth)
627-
else:
628-
new_meta = parse_meta_yaml(new_content)
619+
new_meta = parse_meta_yaml(new_content)
629620
else:
630621
new_meta = parse_recipe_yaml(
631622
new_content, platform_arch=platform_arch, cbc_path=cbc_data

conda_forge_tick/utils.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -510,16 +510,11 @@ def _render_recipe_yaml(
510510
with open(_cbc_path, "w") as fp:
511511
fp.write(str(cbc_path))
512512

513-
variant_config_flags = ["-m", _cbc_path]
513+
variant_config_flags = ["--variant-config", _cbc_path]
514514
else:
515-
variant_config_flags = [] if cbc_path is None else ["-m", str(cbc_path)]
516-
517-
global_cbc_pth = os.path.join(
518-
os.environ["CONDA_PREFIX"], "conda_build_config.yaml"
519-
)
520-
if os.path.exists(global_cbc_pth):
521-
variant_config_flags = ["-m", global_cbc_pth] + variant_config_flags
522-
515+
variant_config_flags = (
516+
[] if cbc_path is None else ["--variant-config", str(cbc_path)]
517+
)
523518
target_platform_flags = (
524519
[]
525520
if platform_arch is None or variant_config_flags

0 commit comments

Comments
 (0)