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

do not add stdlib to outputs without compilers #2330

Merged
merged 1 commit into from
Mar 27, 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
21 changes: 6 additions & 15 deletions conda_forge_tick/migrators/cstdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,9 @@
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.

Expand Down Expand Up @@ -164,17 +159,13 @@
# 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!")

Check warning on line 163 in conda_forge_tick/migrators/cstdlib.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/cstdlib.py#L163

Added line #L163 was not covered by tests

# 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
Expand Down
2 changes: 0 additions & 2 deletions tests/test_yaml/stdlib_rdkit_after_meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ outputs:
- name: rdkit-dev
script: install_rdkit_dev.bat # [win]
requirements:
build:
- {{ stdlib("c") }}
run:
- rdkit
test:
Expand Down