diff --git a/conda_forge_tick/migrators/cstdlib.py b/conda_forge_tick/migrators/cstdlib.py index 2fd327622..6bc39c79e 100644 --- a/conda_forge_tick/migrators/cstdlib.py +++ b/conda_forge_tick/migrators/cstdlib.py @@ -49,14 +49,9 @@ def _process_section(name, attrs, lines): reqs = filtered[0].get("requirements", {}) build_reqs = reqs.get("build", set()) or set() - global_build_reqs = global_reqs.get("build", set()) or set() - # either there's a compiler in the output we're processing, or the - # current output has no build-section but relies on the global one + # check if there's a compiler in the output we're processing needs_stdlib = any(pat_stub.search(x or "") for x in build_reqs) - needs_stdlib |= not bool(build_reqs) and any( - pat_stub.search(x or "") for x in global_build_reqs - ) # see more computation further down depending on dependencies # ignored due to selectors, where we need the line numbers below. @@ -164,17 +159,13 @@ def _process_section(name, attrs, lines): # no build section, need to add it to_insert = indent[:-2] + "build:\n" + to_insert - line_insert = 0 - if line_compiler: - # by default, we insert directly after the compiler - line_insert = line_compiler + 1 - # if there's no compiler, try to insert (in order of preference) - # before the sections for host, run, run_constrained, test - line_insert = line_insert or line_host or line_run or line_constrain or line_test - if not line_insert: - raise RuntimeError("Don't know where to insert build section!") + if not line_compiler: + raise RuntimeError("This shouldn't be possible!") + # by default, we insert directly after the compiler + line_insert = line_compiler + 1 lines = lines[:line_insert] + [to_insert] + lines[line_insert:] + if line_compiler_c and line_compiler_m2c: # we have both compiler("c") and compiler("m2w64_c"), likely with complementary # selectors; add a second stdlib line after m2w64_c with respective selector diff --git a/tests/test_yaml/stdlib_rdkit_after_meta.yaml b/tests/test_yaml/stdlib_rdkit_after_meta.yaml index 56893bac2..66fe5a08a 100644 --- a/tests/test_yaml/stdlib_rdkit_after_meta.yaml +++ b/tests/test_yaml/stdlib_rdkit_after_meta.yaml @@ -85,8 +85,6 @@ outputs: - name: rdkit-dev script: install_rdkit_dev.bat # [win] requirements: - build: - - {{ stdlib("c") }} run: - rdkit test: