Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions grayskull/strategy/py_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

log = logging.getLogger(__name__)
RE_DEPS_NAME = re.compile(r"^\s*([\.a-zA-Z0-9_-]+)", re.MULTILINE)
PIN_PKG_COMPILER = {"numpy": "<{ pin_compatible('numpy') }}"}
PIN_PKG_COMPILER = {}


def search_setup_root(path_folder: Union[Path, str]) -> Path:
Expand Down Expand Up @@ -550,9 +550,10 @@ def clean_list_pkg(pkg, list_pkgs):
pkg_name_match = RE_DEPS_NAME.match(pkg)
if pkg_name_match:
pkg_name = pkg_name_match.group(0)
if pkg_name in PIN_PKG_COMPILER.keys():
pkg_pin = PIN_PKG_COMPILER.get(pkg_name)
if pkg_pin is not None:
requirements["run"] = clean_list_pkg(pkg_name, requirements["run"])
requirements["run"].append(PIN_PKG_COMPILER[pkg_name])
requirements["run"].append(pkg_pin)


def discover_license(metadata: dict) -> List[ShortLicense]:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_py_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def test_update_requirements_with_pin_mixed_numpy_pin_compatible():
"run": ["numpy >=1.19.1,<2.0.0", "pyparsing >=2.4.7, <3.0.0", "python"],
}
update_requirements_with_pin(requirements)
assert "<{ pin_compatible('numpy') }}" in requirements["run"]
assert "numpy" not in requirements["run"]
assert "numpy >=1.19.1,<2.0.0" in requirements["run"]


def test_ensure_pep440_stripping_empty_spaces():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def test_update_requirements_with_pin():
assert req == {
"build": ["<{ compiler('c') }}"],
"host": ["python", "numpy"],
"run": ["python", "<{ pin_compatible('numpy') }}"],
"run": ["python", "numpy"],
}


Expand Down Expand Up @@ -815,7 +815,7 @@ def test_ciso_recipe():
["cython", "numpy", "pip", "python"]
)
assert sorted(recipe["requirements"]["run"]) == sorted(
["cython", "python", "<{ pin_compatible('numpy') }}"]
["cython", "python", "numpy"]
)
assert recipe["test"]["commands"] == ["pip check"]
assert recipe["test"]["requires"] == ["pip"]
Expand All @@ -834,7 +834,7 @@ def test_pymc_recipe_fortran():
}
assert set(recipe["requirements"]["host"]) == {"numpy", "python", "pip"}
assert set(recipe["requirements"]["run"]) == {
"<{ pin_compatible('numpy') }}",
"numpy",
"python",
}
assert not recipe["build"]["noarch"]
Expand Down