Skip to content

Commit

Permalink
fix handling of comments generated from PEP725 matching
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Jan 5, 2024
1 parent 0f448b5 commit 5fef7b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 8 additions & 5 deletions grayskull/strategy/py_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,12 @@ def clean_list_pkg(pkg, list_pkgs):
return [p for p in list_pkgs if pkg != p.strip().split(" ", 1)[0]]

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"])
requirements["run"].append(PIN_PKG_COMPILER[pkg_name])
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():
requirements["run"] = clean_list_pkg(pkg_name, requirements["run"])
requirements["run"].append(PIN_PKG_COMPILER[pkg_name])


def discover_license(metadata: dict) -> List[ShortLicense]:
Expand Down Expand Up @@ -826,7 +828,8 @@ def split_deps(deps: str) -> List[str]:
def ensure_pep440(pkg: str) -> str:
if not pkg:
return pkg
if pkg.strip().startswith("<{") or pkg.strip().startswith("{{"):
pkg = pkg.strip()
if any([pkg.startswith(pattern) for pattern in ("#", "<{", "{{")]):
return pkg
split_pkg = pkg.strip().split(" ")
if len(split_pkg) <= 1:
Expand Down
8 changes: 4 additions & 4 deletions grayskull/strategy/py_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ def get_pep725_mapping(purl: str):
# taken from

package_mapping = {
"virtual:compiler/c": '{{ compiler("c") }}',
"virtual:compiler/cpp": '{{ compiler("cxx") }}',
"virtual:compiler/fortran": '{{ compiler("fortran") }}',
"virtual:compiler/rust": '{{ compiler("rust") }}',
"virtual:compiler/c": "{{ compiler('c') }}",
"virtual:compiler/cpp": "{{ compiler('cxx') }}",
"virtual:compiler/fortran": "{{ compiler('fortran') }}",
"virtual:compiler/rust": "{{ compiler('rust') }}",
"virtual:interface/blas": "{{ blas }}",
}
return (
Expand Down

0 comments on commit 5fef7b0

Please sign in to comment.