Skip to content

Commit

Permalink
feat: use the same marker environment for current platform
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jun 28, 2024
1 parent e882e5d commit 97bb857
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/dep_logic/tags/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,12 @@ def platform_system(self) -> str:
return "Windows"
return "Linux"

def is_current(self) -> bool:
current = self.current()
return isinstance(self.os, type(current.os)) and self.arch == current.arch

def markers(self) -> dict[str, str]:
if self == self.current():
if self.is_current():
return {}
return {
"os_name": self.os_name,
Expand Down
6 changes: 3 additions & 3 deletions src/dep_logic/tags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from platform import python_implementation, python_version
from typing import TYPE_CHECKING

from ..specifiers import VersionSpecifier, parse_version_specifier
from ..specifiers import InvalidSpecifier, VersionSpecifier, parse_version_specifier
from .platform import Platform

if TYPE_CHECKING:
Expand Down Expand Up @@ -32,7 +32,7 @@ def parse_wheel_tags(filename: str) -> tuple[list[str], list[str], list[str]]:
def _ensure_version_specifier(spec: str) -> VersionSpecifier:
parsed = parse_version_specifier(spec)
if not isinstance(parsed, VersionSpecifier):
raise ValueError(f"Invalid version specifier {spec}")
raise InvalidSpecifier(f"Invalid version specifier {spec}")
return parsed


Expand Down Expand Up @@ -133,7 +133,7 @@ def _evaluate_python(
# cp36-cp36m-*
# cp312-cp312m-*
# pp310-pypy310_pp75-*
if abi_impl != "none" and abi_impl != python_tag.lower():
if abi_impl != "none" and not abi_impl.startswith(python_tag.lower()):
return None
if major and minor:
wheel_range = parse_version_specifier(f"=={major}.{minor}.*")
Expand Down

0 comments on commit 97bb857

Please sign in to comment.