Skip to content

Commit

Permalink
Merge pull request #2157 from adament/rattler-ignore_run_exports
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr authored Nov 22, 2024
2 parents b3ad532 + 3d451f3 commit 41e3ac8
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
4 changes: 3 additions & 1 deletion conda_smithy/lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ def lintify_meta_yaml(
lint_legacy_usage_of_compilers(build_requirements, lints)

# 22: Single space in pinned requirements
lint_single_space_in_pinned_requirements(requirements_section, lints)
lint_single_space_in_pinned_requirements(
requirements_section, lints, recipe_version
)

# 23: non noarch builds shouldn't use version constraints on python and r-base
lint_non_noarch_builds(
Expand Down
6 changes: 6 additions & 0 deletions conda_smithy/linter/lints.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@ def lint_single_space_in_pinned_requirements(
recipe_version: int = 0,
):
for section, requirements in requirements_section.items():
if (
recipe_version == 1
and section == "ignore_run_exports"
and requirements
):
requirements = requirements[0].get("from_package", [])
for requirement in requirements or []:
if recipe_version == 1:
req = requirement
Expand Down
23 changes: 23 additions & 0 deletions news/2157-bugfix-ignore_run_exports-for-v1-recipes.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:**

* Fixed a bug that caused the linter to fail when a v1 recipe had the `ignore_run_exports` key. (#2157, #2153)

**Security:**

* <news item>
32 changes: 32 additions & 0 deletions tests/recipes/v1_recipes/recipe-ignore_run_exports-no-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package:
name: foo
version: 1.2.3

source:
url: https://example.com/foo.tar.gz
sha256: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c

build:
number: 0

requirements:
host:
- has_run_export
ignore_run_exports:
from_package:
- has_run_export

tests:
- script:
- echo "Hello, world!"

about:
license: BSD-3-Clause
license_file: LICENSE.txt
homepage: https://example.com/foo
summary: A package that does foo.

extra:
recipe-maintainers:
- Alice
- Bob
8 changes: 8 additions & 0 deletions tests/test_lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,14 @@ def test_v1_recipes():
assert not lints


def test_v1_recipes_ignore_run_exports():
with get_recipe_in_dir(
"v1_recipes/recipe-ignore_run_exports-no-lint.yaml"
) as recipe_dir:
lints, hints = linter.main(str(recipe_dir), return_hints=True)
assert not lints


def test_v1_no_test():
with get_recipe_in_dir("v1_recipes/recipe-no-tests.yaml") as recipe_dir:
lints, hints = linter.main(str(recipe_dir), return_hints=True)
Expand Down

0 comments on commit 41e3ac8

Please sign in to comment.