(info)
| 434 | |
| 435 | |
| 436 | def parse_virtual_specs(info) -> dict: |
| 437 | from .conda_interface import MatchSpec # prevent circular import |
| 438 | |
| 439 | specs = {"__osx": {}, "__glibc": {}} |
| 440 | for spec in info.get("virtual_specs", ()): |
| 441 | spec = MatchSpec(spec) |
| 442 | if spec.name not in ("__osx", "__glibc"): |
| 443 | continue |
| 444 | if not spec.version: |
| 445 | continue |
| 446 | if "|" in spec.version.spec_str: |
| 447 | raise ValueError("Can't process `|`-joined versions. Only `,` is allowed.") |
| 448 | versions = spec.version.tup if "," in spec.version.spec_str else (spec.version,) |
| 449 | for version in versions: |
| 450 | operator = version.operator_func.__name__ |
| 451 | if operator == "ge": |
| 452 | specs[spec.name]["min"] = str(version.matcher_vo) |
| 453 | elif operator == "lt" and spec.name == "__osx": |
| 454 | specs[spec.name]["before"] = str(version.matcher_vo) |
| 455 | else: |
| 456 | raise ValueError( |
| 457 | f"Invalid version operator for {spec}. " |
| 458 | "__osx only supports `<` or `>=`; __glibc only supports `>=`." |
| 459 | ) |
| 460 | return specs |
| 461 | |
| 462 | |
| 463 | def has_docker_buildx() -> bool: |
no test coverage detected