Compare commits

...

1 Commits

Author SHA1 Message Date
Harmen Stoppels
8c8d54db5d archspec: bump 2025-05-21 11:30:30 +02:00
7 changed files with 759 additions and 618 deletions

View File

@ -9,8 +9,8 @@
import argparse import argparse
import typing import typing
import _vendoring.archspec from . import __version__ as archspec_version
import _vendoring.archspec.cpu from .cpu import host
def _make_parser() -> argparse.ArgumentParser: def _make_parser() -> argparse.ArgumentParser:
@ -24,7 +24,7 @@ def _make_parser() -> argparse.ArgumentParser:
"-V", "-V",
help="Show the version and exit.", help="Show the version and exit.",
action="version", action="version",
version=f"archspec, version {_vendoring.archspec.__version__}", version=f"archspec, version {archspec_version}",
) )
parser.add_argument("--help", "-h", help="Show the help and exit.", action="help") parser.add_argument("--help", "-h", help="Show the help and exit.", action="help")
@ -45,9 +45,9 @@ def _make_parser() -> argparse.ArgumentParser:
def cpu() -> int: def cpu() -> int:
"""Run the `_vendoring.archspec.cpu` subcommand.""" """Run the `archspec cpu` subcommand."""
try: try:
print(_vendoring.archspec.cpu.host()) print(host())
except FileNotFoundError as exc: except FileNotFoundError as exc:
print(exc) print(exc)
return 1 return 1

View File

@ -6,12 +6,11 @@
import functools import functools
import platform import platform
import re import re
import sys
import warnings import warnings
from typing import IO, List, Set, Tuple
import _vendoring.archspec from . import schema
import _vendoring.archspec.cpu.alias
import _vendoring.archspec.cpu.schema
from .alias import FEATURE_ALIASES from .alias import FEATURE_ALIASES
from .schema import LazyDictionary from .schema import LazyDictionary
@ -67,7 +66,7 @@ class Microarchitecture:
cpu_part (str): cpu part of the architecture, if relevant. cpu_part (str): cpu part of the architecture, if relevant.
""" """
# pylint: disable=too-many-arguments,too-many-instance-attributes # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-instance-attributes
#: Aliases for micro-architecture's features #: Aliases for micro-architecture's features
feature_aliases = FEATURE_ALIASES feature_aliases = FEATURE_ALIASES
@ -150,17 +149,25 @@ def __ge__(self, other):
return (self == other) or (self > other) return (self == other) or (self > other)
def __repr__(self): def __repr__(self):
cls_name = self.__class__.__name__ return f"{self.__class__.__name__}({self.name!r})"
fmt = (
cls_name + "({0.name!r}, {0.parents!r}, {0.vendor!r}, "
"{0.features!r}, {0.compilers!r}, generation={0.generation!r}, "
"cpu_part={0.cpu_part!r})"
)
return fmt.format(self)
def __str__(self): def __str__(self):
return self.name return self.name
def tree(self, fp: IO[str] = sys.stdout, indent: int = 4) -> None:
"""Format the partial order of ancestors of this microarchitecture as a tree."""
seen: Set[str] = set()
stack: List[Tuple[int, Microarchitecture]] = [(0, self)]
while stack:
level, current = stack.pop()
print(f"{'':>{level}}{current.name}", file=fp)
if current.name in seen:
continue
for parent in reversed(current.parents):
stack.append((level + indent, parent))
def __contains__(self, feature): def __contains__(self, feature):
# Feature must be of a string type, so be defensive about that # Feature must be of a string type, so be defensive about that
if not isinstance(feature, str): if not isinstance(feature, str):
@ -384,7 +391,7 @@ def fill_target_from_dict(name, data, targets):
) )
known_targets = {} known_targets = {}
data = _vendoring.archspec.cpu.schema.TARGETS_JSON["microarchitectures"] data = schema.TARGETS_JSON["microarchitectures"]
for name in data: for name in data:
if name in known_targets: if name in known_targets:
# name was already brought in as ancestor to a target # name was already brought in as ancestor to a target

View File

@ -131,4 +131,4 @@
} }
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -110,4 +110,4 @@
"additionalProperties": false "additionalProperties": false
} }
} }
} }

View File

@ -9,4 +9,4 @@ macholib==1.16.2
altgraph==0.17.3 altgraph==0.17.3
ruamel.yaml==0.17.21 ruamel.yaml==0.17.21
typing_extensions==4.1.1 typing_extensions==4.1.1
archspec @ git+https://github.com/archspec/archspec.git@38ce485258ffc4fc6dd6688f8dc90cb269478c47 archspec @ git+https://github.com/archspec/archspec.git@77f3f81df3dd80b7e538e2e41bc4485fbec2dbaa

View File

@ -260,9 +260,6 @@ substitute = [
{ match = "from attr", replace = "from _vendoring.attr" }, { match = "from attr", replace = "from _vendoring.attr" },
{ match = "import jsonschema", replace = "import _vendoring.jsonschema" }, { match = "import jsonschema", replace = "import _vendoring.jsonschema" },
{ match = "from jsonschema", replace = "from _vendoring.jsonschema" }, { match = "from jsonschema", replace = "from _vendoring.jsonschema" },
{ match = "archspec.cpu", replace = "_vendoring.archspec.cpu" },
{ match = "archspec.__version__", replace = "_vendoring.archspec.__version__" },
{ match = "import archspec", replace = "import _vendoring.archspec" },
] ]
drop = [ drop = [
# contains unnecessary scripts # contains unnecessary scripts