Skip to content

Fix v1 stdlib lint not firing for double-quoted compiler() calls - #2615

Merged
h-vetinari merged 1 commit into
conda-forge:mainfrom
pb01ka:stdlib-fix
Jul 8, 2026
Merged

Fix v1 stdlib lint not firing for double-quoted compiler() calls#2615
h-vetinari merged 1 commit into
conda-forge:mainfrom
pb01ka:stdlib-fix

Conversation

@pb01ka

@pb01ka pb01ka commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • Added a news entry with any new deprecations added to the Deprecated section.
  • Regenerated schema JSON if schema altered (python -m conda_smithy.schema)
  • Regenerated linter documentation if any rules were added, removed or modified (python -m conda_smithy.linter.messages)

Fixes #2572

Problem

The lint_stdlib check is supposed to flag a v1 recipe that uses a compiler (e.g. ${{ compiler("c") }}) without also declaring the matching C stdlib (${{ stdlib("c") }}). It detects compiler usage via the pat_compiler_stub regex, which for v1 recipes was:

r"^\${{ compiler\('(m2w64_)?(c|cxx|fortran|rust|go-cgo)"

This only matches a single-quoted argument (compiler('c')). Recipes that use double quotes (compiler("c")) - a perfectly valid and common style, e.g. openimageio-feedstock#138 - were never detected as using a compiler at all, so the stdlib check was silently skipped. This let a recipe merge without ${{ stdlib("c") }}, which in turn caused openimageio-feedstock#150.

The sibling stdlib_regex a few lines below already handled both quote styles (['\"]) - the compiler-detection regex was just never updated to match.

Fix

Update pat_compiler_stub to accept either quote character:

r"^\${{ compiler\(['\"](m2w64_)?(c|cxx|fortran|rust|go-cgo)"

Testing

Parametrized test_v1_stdlib_hint over both ' and " quote styles. Confirmed the new double-quote cases fail against the old regex and pass with the fix; the full stdlib/compiler test suite (29 tests) passes.

In addition to this the recipe from openimageio-feedstock#138 now fails with this PR (which is the expectation),

(py313) 1:58:21:~/conda-smithy % conda smithy recipe-lint ../recipe-dir
../recipe-dir has some lint:
  This recipe is using a compiler, which now requires adding a build dependence on `${{ stdlib("c") }}` as well. Note that this rule applies to each output of the recipe using a compiler. For further details, please see https://github.com/conda-forge/conda-forge.github.io/issues/2102.

@pb01ka
pb01ka requested a review from a team as a code owner July 7, 2026 20:32

@h-vetinari h-vetinari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@h-vetinari
h-vetinari merged commit 5870a62 into conda-forge:main Jul 8, 2026
2 checks passed
mgorny pushed a commit to mgorny/conda-smithy that referenced this pull request Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: stdlib lints not working in v1 recipes

2 participants