Skip to content

Commit

Permalink
Fix mixed numpy and pin_compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotrevisani committed Feb 17, 2022
1 parent e2b20d4 commit 184c587
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions grayskull/strategy/py_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,19 @@ def is_compiler_present() -> bool:

if not is_compiler_present():
return

def clean_list_pkg(pkg, list_pkgs):
result = []
for p in list_pkgs:
if pkg == p.strip().split(" ", 1)[0]:
continue
result.append(p)
return result

for pkg in requirements["host"]:
pkg_name = RE_DEPS_NAME.match(pkg).group(0)
if pkg_name in PIN_PKG_COMPILER.keys():
requirements["run"] = clean_list_pkg(pkg_name, requirements["run"])
if pkg_name in requirements["run"]:
requirements["run"].remove(pkg_name)
requirements["run"].append(PIN_PKG_COMPILER[pkg_name])
Expand Down
6 changes: 6 additions & 0 deletions tests/test_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,3 +875,9 @@ def test_create_recipe_from_local_sdist(pkg_pytest):
def test_400_for_python_selector():
recipe = create_python_recipe("pyquil", version="3.0.1")[0]
assert recipe["build"]["skip"].selector == "py>=400 or py2k"


def test_numpy_and_pin_compatible_mixed():
recipe = create_python_recipe("dimod", version="0.10.13")[0]
assert "<{ pin_compatible('numpy') }}" in list(recipe["requirements"]["run"])
assert "numpy" not in list(recipe["requirements"]["run"])

0 comments on commit 184c587

Please sign in to comment.