Skip to content

Commit

Permalink
Merge pull request #1735 from jaimergp/fix-linter-noarch-selectors
Browse files Browse the repository at this point in the history
allow operators in noarch selector lint
  • Loading branch information
jaimergp authored Aug 24, 2023
2 parents 16666ed + d6d357c commit 288dea8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
9 changes: 7 additions & 2 deletions conda_smithy/lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,13 @@ def is_selector_line(line, allow_platforms=False):
return False
m = sel_pat.match(line)
if m:
if allow_platforms and m.group(3) in ["win", "linux", "osx", "unix"]:
return False
if allow_platforms:
nouns = {
w for w in m.group(3).split() if w not in ("not", "and", "or")
}
if nouns.issubset({"win", "linux", "osx", "unix"}):
# the selector only contains (a boolean chain of) platform selectors
return False
else:
return True
return False
Expand Down
23 changes: 23 additions & 0 deletions news/noarch-platforms-lint-selectors-operators.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Allow operators in noarch platform selectors

**Security:**

* <news item>
2 changes: 1 addition & 1 deletion tests/recipes/noarch_platforms/recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ requirements:
- tomli >=1.0.0
- colorama # [win]
- __win # [win]
- __unix # [unix]
- __unix # [not win]

run_constrained:
# pytest-faulthandler 2 is a dummy package.
Expand Down

0 comments on commit 288dea8

Please sign in to comment.