Skip to content

Commit

Permalink
fix: lint for noarch: python happens after render
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Nov 7, 2024
1 parent 0541fba commit 13efddb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion conda_smithy/linter/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,13 @@ def hint_noarch_python_use_python_min(
syntax = syntax.replace(
"{{ python_min }}", "${{ python_min }}"
)
test_syntax = syntax.replace("{{ python_min }}", "9999")

for req in reqs:
if (
req.strip().split()[0] == "python"
and req != "python"
and syntax in req
and test_syntax in req
):
break
else:
Expand Down
1 change: 1 addition & 0 deletions conda_smithy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def render_meta_yaml(text):
target_platform="linux-64",
build_platform="linux-64",
mpi="mpi",
python_min="9999", # use as a sentinel value for linting
)
)
mockos = MockOS()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import conda_smithy.lint_recipe as linter
from conda_smithy.linter.utils import VALID_PYTHON_BUILD_BACKENDS
from conda_smithy.utils import get_yaml
from conda_smithy.utils import get_yaml, render_meta_yaml

_thisdir = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -3163,7 +3163,7 @@ def test_hint_noarch_python_use_python_min(
meta_str,
expected_hints,
):
meta = get_yaml().load(meta_str)
meta = get_yaml().load(render_meta_yaml(meta_str))
lints = []
hints = []
linter.run_conda_forge_specific(
Expand Down Expand Up @@ -3250,7 +3250,7 @@ def test_hint_noarch_python_use_python_min_v1(
meta_str,
expected_hints,
):
meta = get_yaml().load(meta_str)
meta = get_yaml().load(render_meta_yaml(meta_str.replace("${{", "{{")))
lints = []
hints = []
linter.run_conda_forge_specific(
Expand Down

0 comments on commit 13efddb

Please sign in to comment.