Repository: conda-forge/conda-smithy

Issue:
Linter hint about `{{ stdlib("c") }}` variable is incorrect for noarch packages
### Solution to issue cannot be found in the documentation.

- [X] I checked the documentation.

### Issue

Platform-specific noarch packages that use `__osx` receive a hint that they should depend on `{{ stdlib("c") }}` but they are noarch and do not require it.

Example: https://github.com/conda-forge/poetry-feedstock/pull/99#issuecomment-2101613350
Code: https://github.com/conda-forge/conda-smithy/blob/f892a5b8ceed015cae5dab453a6869e2ca861f87/conda_smithy/lint_recipe.py#L885
Background: https://github.com/conda-forge/conda-forge.github.io/issues/2102#issuecomment-2103123950


Discussion:

Patch:
diff --git a/conda_smithy/lint_recipe.py b/conda_smithy/lint_recipe.py
index e16868b0..e5c58c2a 100644
--- a/conda_smithy/lint_recipe.py
+++ b/conda_smithy/lint_recipe.py
@@ -882,7 +882,7 @@ def lintify_meta_yaml(
         "the respective platform as necessary. For further details, please see "
         "https://github.com/conda-forge/conda-forge.github.io/issues/2102."
     )
-    if any(req.startswith("__osx") for req in run_reqs + constraints):
+    if any(req.startswith("__osx >") for req in run_reqs + constraints):
         if osx_hint not in hints:
             hints.append(osx_hint)
 
diff --git a/news/1925-linter.rst b/news/1925-linter.rst
new file mode 100644
index 00000000..444df8f9
--- /dev/null
+++ b/news/1925-linter.rst
@@ -0,0 +1,23 @@
+**Added:**
+
+* <news item>
+
+**Changed:**
+
+* <news item>
+
+**Deprecated:**
+
+* <news item>
+
+**Removed:**
+
+* <news item>
+
+**Fixed:**
+
+* linter no longer mis-diagnoses constraint-less ``__osx`` as requiring change. (#1925)
+
+**Security:**
+
+* <news item>


Test patch:
diff --git a/tests/test_lint_recipe.py b/tests/test_lint_recipe.py
index 545b1979..8fc09724 100644
--- a/tests/test_lint_recipe.py
+++ b/tests/test_lint_recipe.py
@@ -94,6 +94,28 @@ def test_osx_hint(where):
         assert any(h.startswith(expected_message) for h in hints)
 
 
+@pytest.mark.parametrize("where", ["run", "run_constrained"])
+def test_osx_noarch_hint(where):
+    # don't warn on packages that are using __osx as a noarch-marker, see
+    # https://conda-forge.org/docs/maintainer/knowledge_base/#noarch-packages-with-os-specific-dependencies
+    avoid_message = "You're setting a constraint on the `__osx` virtual"
+
+    with tmp_directory() as recipe_dir:
+        with io.open(os.path.join(recipe_dir, "meta.yaml"), "w") as fh:
+            fh.write(
+                f"""
+                package:
+                   name: foo
+                requirements:
+                  {where}:
+                    - __osx  # [osx]
+                """
+            )
+
+        _, hints = linter.main(recipe_dir, return_hints=True)
+        assert not any(h.startswith(avoid_message) for h in hints)
+
+
 class Test_linter(unittest.TestCase):
     def test_pin_compatible_in_run_exports(self):
         meta = {