diff --git a/conda_smithy/lint_recipe.py b/conda_smithy/lint_recipe.py index 4876a53da..8a1cc01b4 100644 --- a/conda_smithy/lint_recipe.py +++ b/conda_smithy/lint_recipe.py @@ -149,6 +149,14 @@ def lintify(meta, recipe_dir=None): except RuntimeError as e: lints.append(str(e)) + # 13: If cython/numpy is a build-dependency then python should be a run-time + # dependency. This ensures that packages will be marked correctly by conda + build_deps = ['cython', 'numpy x.x'] + need_python_run_time = any([dep in requirements_section.get('build', '') for dep in build_deps]) + if need_python_run_time and 'python' not in requirements_section.get('run', ''): + lints.append("Found python related compilation requirement " + "please add python as a run-time dependency") + return lints diff --git a/conda_smithy/tests/test_lint_recipe.py b/conda_smithy/tests/test_lint_recipe.py index 24f14c345..96dea7bcd 100644 --- a/conda_smithy/tests/test_lint_recipe.py +++ b/conda_smithy/tests/test_lint_recipe.py @@ -253,6 +253,15 @@ def test_end_empty_line(self): else: self.assertIn(expected_message, lints) + def test_implicit_python_run_time_dependency(self): + build_deps = ['cython', 'numpy x.x'] + expected_message = ("Found python related compilation requirement " + "please add python as a run-time dependency") + for dep in build_deps: + meta = {'requirements': {'build': [dep, 'python']}} + lints = linter.lintify(meta) + self.assertIn(expected_message, lints) + class TestCLI_recipe_lint(unittest.TestCase): def test_cli_fail(self):