archspec: change module from archspec to _vendoring.archspec (#50450)

This commit is contained in:
Harmen Stoppels 2025-05-21 11:25:02 +02:00 committed by GitHub
parent de6f07094e
commit 0107792a9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 145 additions and 441 deletions

View File

@ -228,7 +228,7 @@ def setup(sphinx):
("py:class", "spack.install_test.Pb"), ("py:class", "spack.install_test.Pb"),
("py:class", "spack.filesystem_view.SimpleFilesystemView"), ("py:class", "spack.filesystem_view.SimpleFilesystemView"),
("py:class", "spack.traverse.EdgeAndDepth"), ("py:class", "spack.traverse.EdgeAndDepth"),
("py:class", "archspec.cpu.microarchitecture.Microarchitecture"), ("py:class", "_vendoring.archspec.cpu.microarchitecture.Microarchitecture"),
("py:class", "spack.compiler.CompilerCache"), ("py:class", "spack.compiler.CompilerCache"),
# TypeVar that is not handled correctly # TypeVar that is not handled correctly
("py:class", "llnl.util.lang.T"), ("py:class", "llnl.util.lang.T"),

View File

@ -1 +0,0 @@
from _pyrsistent_version import *

View File

@ -1 +0,0 @@
from altgraph import *

View File

@ -1,3 +1,3 @@
"""Init file to avoid namespace packages""" """Init file to avoid namespace packages"""
__version__ = "0.2.4" __version__ = "0.2.5"

View File

@ -9,8 +9,8 @@
import argparse import argparse
import typing import typing
import archspec import _vendoring.archspec
import archspec.cpu import _vendoring.archspec.cpu
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 {archspec.__version__}", version=f"archspec, version {_vendoring.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 `archspec cpu` subcommand.""" """Run the `_vendoring.archspec.cpu` subcommand."""
try: try:
print(archspec.cpu.host()) print(_vendoring.archspec.cpu.host())
except FileNotFoundError as exc: except FileNotFoundError as exc:
print(exc) print(exc)
return 1 return 1

View File

@ -8,9 +8,9 @@
import re import re
import warnings import warnings
import archspec import _vendoring.archspec
import archspec.cpu.alias import _vendoring.archspec.cpu.alias
import archspec.cpu.schema import _vendoring.archspec.cpu.schema
from .alias import FEATURE_ALIASES from .alias import FEATURE_ALIASES
from .schema import LazyDictionary from .schema import LazyDictionary
@ -384,7 +384,7 @@ def fill_target_from_dict(name, data, targets):
) )
known_targets = {} known_targets = {}
data = archspec.cpu.schema.TARGETS_JSON["microarchitectures"] data = _vendoring.archspec.cpu.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

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Anders Høst
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1 +0,0 @@
from jsonschema import *

View File

@ -1 +0,0 @@
from macholib import *

View File

@ -1,213 +0,0 @@
# flake8: noqa: E704
# from https://gist.github.com/WuTheFWasThat/091a17d4b5cab597dfd5d4c2d96faf09
# Stubs for pyrsistent (Python 3.6)
from typing import Any
from typing import AnyStr
from typing import Callable
from typing import Iterable
from typing import Iterator
from typing import List
from typing import Optional
from typing import Mapping
from typing import MutableMapping
from typing import Sequence
from typing import Set
from typing import Union
from typing import Tuple
from typing import Type
from typing import TypeVar
from typing import overload
# see commit 08519aa for explanation of the re-export
from pyrsistent.typing import CheckedKeyTypeError as CheckedKeyTypeError
from pyrsistent.typing import CheckedPMap as CheckedPMap
from pyrsistent.typing import CheckedPSet as CheckedPSet
from pyrsistent.typing import CheckedPVector as CheckedPVector
from pyrsistent.typing import CheckedType as CheckedType
from pyrsistent.typing import CheckedValueTypeError as CheckedValueTypeError
from pyrsistent.typing import InvariantException as InvariantException
from pyrsistent.typing import PClass as PClass
from pyrsistent.typing import PBag as PBag
from pyrsistent.typing import PDeque as PDeque
from pyrsistent.typing import PList as PList
from pyrsistent.typing import PMap as PMap
from pyrsistent.typing import PMapEvolver as PMapEvolver
from pyrsistent.typing import PSet as PSet
from pyrsistent.typing import PSetEvolver as PSetEvolver
from pyrsistent.typing import PTypeError as PTypeError
from pyrsistent.typing import PVector as PVector
from pyrsistent.typing import PVectorEvolver as PVectorEvolver
T = TypeVar('T')
KT = TypeVar('KT')
VT = TypeVar('VT')
def pmap(initial: Union[Mapping[KT, VT], Iterable[Tuple[KT, VT]]] = {}, pre_size: int = 0) -> PMap[KT, VT]: ...
def m(**kwargs: VT) -> PMap[str, VT]: ...
def pvector(iterable: Iterable[T] = ...) -> PVector[T]: ...
def v(*iterable: T) -> PVector[T]: ...
def pset(iterable: Iterable[T] = (), pre_size: int = 8) -> PSet[T]: ...
def s(*iterable: T) -> PSet[T]: ...
# see class_test.py for use cases
Invariant = Tuple[bool, Optional[Union[str, Callable[[], str]]]]
@overload
def field(
type: Union[Type[T], Sequence[Type[T]]] = ...,
invariant: Callable[[Any], Union[Invariant, Iterable[Invariant]]] = lambda _: (True, None),
initial: Any = object(),
mandatory: bool = False,
factory: Callable[[Any], T] = lambda x: x,
serializer: Callable[[Any, T], Any] = lambda _, value: value,
) -> T: ...
# The actual return value (_PField) is irrelevant after a PRecord has been instantiated,
# see https://github.com/tobgu/pyrsistent/blob/master/pyrsistent/_precord.py#L10
@overload
def field(
type: Any = ...,
invariant: Callable[[Any], Union[Invariant, Iterable[Invariant]]] = lambda _: (True, None),
initial: Any = object(),
mandatory: bool = False,
factory: Callable[[Any], Any] = lambda x: x,
serializer: Callable[[Any, Any], Any] = lambda _, value: value,
) -> Any: ...
# Use precise types for the simplest use cases, but fall back to Any for
# everything else. See record_test.py for the wide range of possible types for
# item_type
@overload
def pset_field(
item_type: Type[T],
optional: bool = False,
initial: Iterable[T] = ...,
) -> PSet[T]: ...
@overload
def pset_field(
item_type: Any,
optional: bool = False,
initial: Any = (),
) -> PSet[Any]: ...
@overload
def pmap_field(
key_type: Type[KT],
value_type: Type[VT],
optional: bool = False,
invariant: Callable[[Any], Tuple[bool, Optional[str]]] = lambda _: (True, None),
) -> PMap[KT, VT]: ...
@overload
def pmap_field(
key_type: Any,
value_type: Any,
optional: bool = False,
invariant: Callable[[Any], Tuple[bool, Optional[str]]] = lambda _: (True, None),
) -> PMap[Any, Any]: ...
@overload
def pvector_field(
item_type: Type[T],
optional: bool = False,
initial: Iterable[T] = ...,
) -> PVector[T]: ...
@overload
def pvector_field(
item_type: Any,
optional: bool = False,
initial: Any = (),
) -> PVector[Any]: ...
def pbag(elements: Iterable[T]) -> PBag[T]: ...
def b(*elements: T) -> PBag[T]: ...
def plist(iterable: Iterable[T] = (), reverse: bool = False) -> PList[T]: ...
def l(*elements: T) -> PList[T]: ...
def pdeque(iterable: Optional[Iterable[T]] = None, maxlen: Optional[int] = None) -> PDeque[T]: ...
def dq(*iterable: T) -> PDeque[T]: ...
@overload
def optional(type: T) -> Tuple[T, Type[None]]: ...
@overload
def optional(*typs: Any) -> Tuple[Any, ...]: ...
T_PRecord = TypeVar('T_PRecord', bound='PRecord')
class PRecord(PMap[AnyStr, Any]):
_precord_fields: Mapping
_precord_initial_values: Mapping
def __hash__(self) -> int: ...
def __init__(self, **kwargs: Any) -> None: ...
def __iter__(self) -> Iterator[Any]: ...
def __len__(self) -> int: ...
@classmethod
def create(
cls: Type[T_PRecord],
kwargs: Mapping,
_factory_fields: Optional[Iterable] = None,
ignore_extra: bool = False,
) -> T_PRecord: ...
# This is OK because T_PRecord is a concrete type
def discard(self: T_PRecord, key: KT) -> T_PRecord: ...
def remove(self: T_PRecord, key: KT) -> T_PRecord: ...
def serialize(self, format: Optional[Any] = ...) -> MutableMapping: ...
# From pyrsistent documentation:
# This set function differs slightly from that in the PMap
# class. First of all it accepts key-value pairs. Second it accepts multiple key-value
# pairs to perform one, atomic, update of multiple fields.
@overload
def set(self, key: KT, val: VT) -> Any: ...
@overload
def set(self, **kwargs: VT) -> Any: ...
def immutable(
members: Union[str, Iterable[str]] = '',
name: str = 'Immutable',
verbose: bool = False,
) -> Tuple: ... # actually a namedtuple
# ignore mypy warning "Overloaded function signatures 1 and 5 overlap with
# incompatible return types"
@overload
def freeze(o: Mapping[KT, VT]) -> PMap[KT, VT]: ... # type: ignore
@overload
def freeze(o: List[T]) -> PVector[T]: ... # type: ignore
@overload
def freeze(o: Tuple[T, ...]) -> Tuple[T, ...]: ...
@overload
def freeze(o: Set[T]) -> PSet[T]: ... # type: ignore
@overload
def freeze(o: T) -> T: ...
@overload
def thaw(o: PMap[KT, VT]) -> MutableMapping[KT, VT]: ... # type: ignore
@overload
def thaw(o: PVector[T]) -> List[T]: ... # type: ignore
@overload
def thaw(o: Tuple[T, ...]) -> Tuple[T, ...]: ...
# collections.abc.MutableSet is kind of garbage:
# https://stackoverflow.com/questions/24977898/why-does-collections-mutableset-not-bestow-an-update-method
@overload
def thaw(o: PSet[T]) -> Set[T]: ... # type: ignore
@overload
def thaw(o: T) -> T: ...
def mutant(fn: Callable) -> Callable: ...
def inc(x: int) -> int: ...
@overload
def discard(evolver: PMapEvolver[KT, VT], key: KT) -> None: ...
@overload
def discard(evolver: PVectorEvolver[T], key: int) -> None: ...
@overload
def discard(evolver: PSetEvolver[T], key: T) -> None: ...
def rex(expr: str) -> Callable[[Any], bool]: ...
def ny(_: Any) -> bool: ...
def get_in(keys: Iterable, coll: Mapping, default: Optional[Any] = None, no_default: bool = False) -> Any: ...

View File

@ -1 +0,0 @@
from ruamel import *

View File

@ -1 +0,0 @@
from six import *

View File

@ -1 +0,0 @@
from six.moves import *

View File

@ -1 +0,0 @@
from six.moves.configparser import *

View File

@ -1,81 +0,0 @@
[![](https://github.com/archspec/archspec/workflows/Unit%20tests/badge.svg)](https://github.com/archspec/archspec/actions)
[![codecov](https://codecov.io/gh/archspec/archspec/branch/master/graph/badge.svg)](https://codecov.io/gh/archspec/archspec)
[![Documentation Status](https://readthedocs.org/projects/archspec/badge/?version=latest)](https://archspec.readthedocs.io/en/latest/?badge=latest)
# Archspec (Python bindings)
Archspec aims at providing a standard set of human-understandable labels for
various aspects of a system architecture like CPU, network fabrics, etc. and
APIs to detect, query and compare them.
This project grew out of [Spack](https://spack.io/) and is currently under
active development. At present it supports APIs to detect and model
compatibility relationships among different CPU microarchitectures.
## Getting started with development
The `archspec` Python package needs [poetry](https://python-poetry.org/) to
be installed from VCS sources. The preferred method to install it is via
its custom installer outside of any virtual environment:
```console
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
```
You can refer to [Poetry's documentation](https://python-poetry.org/docs/#installation)
for further details or for other methods to install this tool. You'll also need `tox`
to run unit test:
```console
$ pip install --user tox
```
Finally you'll need to clone the repository:
```console
$ git clone --recursive https://github.com/archspec/archspec.git
```
### Running unit tests
Once you have your environment ready you can run `archspec` unit tests
using ``tox`` from the root of the repository:
```console
$ tox
[ ... ]
py27: commands succeeded
py35: commands succeeded
py36: commands succeeded
py37: commands succeeded
py38: commands succeeded
pylint: commands succeeded
flake8: commands succeeded
black: commands succeeded
congratulations :)
```
## Citing Archspec
If you are referencing `archspec` in a publication, please cite the following
paper:
* Massimiliano Culpo, Gregory Becker, Carlos Eduardo Arango Gutierrez, Kenneth
Hoste, and Todd Gamblin.
[**`archspec`: A library for detecting, labeling, and reasoning about
microarchitectures**](https://tgamblin.github.io/pubs/archspec-canopie-hpc-2020.pdf).
In *2nd International Workshop on Containers and New Orchestration Paradigms
for Isolated Environments in HPC (CANOPIE-HPC'20)*, Online Event, November
12, 2020.
## License
Archspec is distributed under the terms of both the MIT license and the
Apache License (Version 2.0). Users may choose either license, at their
option.
All new contributions must be made under both the MIT and Apache-2.0
licenses.
See [LICENSE-MIT](https://github.com/archspec/archspec/blob/master/LICENSE-MIT),
[LICENSE-APACHE](https://github.com/archspec/archspec/blob/master/LICENSE-APACHE),
[COPYRIGHT](https://github.com/archspec/archspec/blob/master/COPYRIGHT), and
[NOTICE](https://github.com/archspec/archspec/blob/master/NOTICE) for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT)
LLNL-CODE-811653

View File

@ -1,22 +0,0 @@
Intellectual Property Notice
------------------------------
Archspec is licensed under the Apache License, Version 2.0 (LICENSE-APACHE
or http://www.apache.org/licenses/LICENSE-2.0) or the MIT license,
(LICENSE-MIT or http://opensource.org/licenses/MIT), at your option.
Copyrights and patents in the Archspec project are retained by contributors.
No copyright assignment is required to contribute to Archspec.
SPDX usage
------------
Individual files contain SPDX tags instead of the full license text.
This enables machine processing of license information based on the SPDX
License Identifiers that are available here: https://spdx.org/licenses/
Files that are dual-licensed as Apache-2.0 OR MIT contain the following
text in the license header:
SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -9,3 +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

View File

@ -12,10 +12,9 @@
import warnings import warnings
from typing import Optional, Sequence, Union from typing import Optional, Sequence, Union
import _vendoring.archspec.cpu
from _vendoring.typing_extensions import TypedDict from _vendoring.typing_extensions import TypedDict
import archspec.cpu
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
from llnl.util import tty from llnl.util import tty
@ -138,7 +137,7 @@ def _fix_ext_suffix(candidate_spec: "spack.spec.Spec"):
} }
# If the current architecture is not problematic return # If the current architecture is not problematic return
generic_target = archspec.cpu.host().family generic_target = _vendoring.archspec.cpu.host().family
if str(generic_target) not in _suffix_to_be_checked: if str(generic_target) not in _suffix_to_be_checked:
return return
@ -235,7 +234,7 @@ def _root_spec(spec_str: str) -> str:
platform = str(spack.platforms.host()) platform = str(spack.platforms.host())
spec_str += f" platform={platform}" spec_str += f" platform={platform}"
target = archspec.cpu.host().family target = _vendoring.archspec.cpu.host().family
spec_str += f" target={target}" spec_str += f" target={target}"
tty.debug(f"[BOOTSTRAP ROOT SPEC] {spec_str}") tty.debug(f"[BOOTSTRAP ROOT SPEC] {spec_str}")

View File

@ -13,7 +13,7 @@
import sys import sys
from typing import Dict, Optional, Tuple from typing import Dict, Optional, Tuple
import archspec.cpu import _vendoring.archspec.cpu
import spack.compilers.config import spack.compilers.config
import spack.compilers.libraries import spack.compilers.libraries
@ -30,7 +30,7 @@ class ClingoBootstrapConcretizer:
def __init__(self, configuration): def __init__(self, configuration):
self.host_platform = spack.platforms.host() self.host_platform = spack.platforms.host()
self.host_os = self.host_platform.default_operating_system() self.host_os = self.host_platform.default_operating_system()
self.host_target = archspec.cpu.host().family self.host_target = _vendoring.archspec.cpu.host().family
self.host_architecture = spack.spec.ArchSpec.default_arch() self.host_architecture = spack.spec.ArchSpec.default_arch()
self.host_architecture.target = str(self.host_target) self.host_architecture.target = str(self.host_target)
self.host_compiler = self._valid_compiler_or_raise() self.host_compiler = self._valid_compiler_or_raise()

View File

@ -8,7 +8,7 @@
import sys import sys
from typing import Iterable, List from typing import Iterable, List
import archspec.cpu import _vendoring.archspec.cpu
from llnl.util import tty from llnl.util import tty
@ -51,7 +51,7 @@ def environment_root(cls) -> pathlib.Path:
"""Environment root directory""" """Environment root directory"""
bootstrap_root_path = root_path() bootstrap_root_path = root_path()
python_part = spec_for_current_python().replace("@", "") python_part = spec_for_current_python().replace("@", "")
arch_part = archspec.cpu.host().family arch_part = _vendoring.archspec.cpu.host().family
interpreter_part = hashlib.md5(sys.exec_prefix.encode()).hexdigest()[:5] interpreter_part = hashlib.md5(sys.exec_prefix.encode()).hexdigest()[:5]
environment_dir = f"{python_part}-{arch_part}-{interpreter_part}" environment_dir = f"{python_part}-{arch_part}-{interpreter_part}"
return pathlib.Path( return pathlib.Path(
@ -112,7 +112,7 @@ def _write_spack_yaml_file(self) -> None:
context = { context = {
"python_spec": spec_for_current_python(), "python_spec": spec_for_current_python(),
"python_prefix": sys.exec_prefix, "python_prefix": sys.exec_prefix,
"architecture": archspec.cpu.host().family, "architecture": _vendoring.archspec.cpu.host().family,
"environment_path": self.environment_root(), "environment_path": self.environment_root(),
"environment_specs": self.spack_dev_requirements(), "environment_specs": self.spack_dev_requirements(),
"store_path": store_path(), "store_path": store_path(),

View File

@ -59,7 +59,7 @@
overload, overload,
) )
import archspec.cpu import _vendoring.archspec.cpu
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.string import plural from llnl.string import plural
@ -440,10 +440,12 @@ def optimization_flags(compiler, target):
# Try to check if the current compiler comes with a version number or # Try to check if the current compiler comes with a version number or
# has an unexpected suffix. If so, treat it as a compiler with a # has an unexpected suffix. If so, treat it as a compiler with a
# custom spec. # custom spec.
version_number, _ = archspec.cpu.version_components(compiler.version.dotted_numeric_string) version_number, _ = _vendoring.archspec.cpu.version_components(
compiler.version.dotted_numeric_string
)
try: try:
result = target.optimization_flags(compiler.name, version_number) result = target.optimization_flags(compiler.name, version_number)
except (ValueError, archspec.cpu.UnsupportedMicroarchitecture): except (ValueError, _vendoring.archspec.cpu.UnsupportedMicroarchitecture):
result = "" result = ""
return result return result

View File

@ -5,7 +5,7 @@
import collections import collections
import warnings import warnings
import archspec.cpu import _vendoring.archspec.cpu
import llnl.util.tty.colify as colify import llnl.util.tty.colify as colify
import llnl.util.tty.color as color import llnl.util.tty.color as color
@ -92,11 +92,11 @@ def display_target_group(header, target_group):
def arch(parser, args): def arch(parser, args):
if args.generic_target: if args.generic_target:
# TODO: add deprecation warning in 0.24 # TODO: add deprecation warning in 0.24
print(archspec.cpu.host().generic) print(_vendoring.archspec.cpu.host().generic)
return return
if args.known_targets: if args.known_targets:
display_targets(archspec.cpu.TARGETS) display_targets(_vendoring.archspec.cpu.TARGETS)
return return
if args.frontend: if args.frontend:

View File

@ -10,7 +10,7 @@
import warnings import warnings
from typing import Any, Dict, List, Optional, Tuple from typing import Any, Dict, List, Optional, Tuple
import archspec.cpu import _vendoring.archspec.cpu
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
import llnl.util.lang import llnl.util.lang
@ -316,7 +316,7 @@ def from_external_yaml(config: Dict[str, Any]) -> Optional[spack.spec.Spec]:
@staticmethod @staticmethod
def _finalize_external_concretization(abstract_spec): def _finalize_external_concretization(abstract_spec):
if CompilerFactory._GENERIC_TARGET is None: if CompilerFactory._GENERIC_TARGET is None:
CompilerFactory._GENERIC_TARGET = archspec.cpu.host().family CompilerFactory._GENERIC_TARGET = _vendoring.archspec.cpu.host().family
if abstract_spec.architecture: if abstract_spec.architecture:
abstract_spec.architecture.complete_with_defaults() abstract_spec.architecture.complete_with_defaults()

View File

@ -25,7 +25,7 @@
import warnings import warnings
from typing import List, Tuple from typing import List, Tuple
import archspec.cpu import _vendoring.archspec.cpu
import llnl.util.lang import llnl.util.lang
import llnl.util.tty as tty import llnl.util.tty as tty
@ -734,7 +734,7 @@ def _compatible_sys_types():
""" """
host_platform = spack.platforms.host() host_platform = spack.platforms.host()
host_os = str(host_platform.default_operating_system()) host_os = str(host_platform.default_operating_system())
host_target = archspec.cpu.host() host_target = _vendoring.archspec.cpu.host()
compatible_targets = [host_target] + host_target.ancestors compatible_targets = [host_target] + host_target.ancestors
compatible_archs = [ compatible_archs = [
@ -794,7 +794,7 @@ def shell_set(var, value):
# print environment module system if available. This can be expensive # print environment module system if available. This can be expensive
# on clusters, so skip it if not needed. # on clusters, so skip it if not needed.
if "modules" in info: if "modules" in info:
generic_arch = archspec.cpu.host().family generic_arch = _vendoring.archspec.cpu.host().family
module_spec = "environment-modules target={0}".format(generic_arch) module_spec = "environment-modules target={0}".format(generic_arch)
specs = spack.store.STORE.db.query(module_spec) specs = spack.store.STORE.db.query(module_spec)
if specs: if specs:

View File

@ -4,7 +4,7 @@
import warnings import warnings
from typing import Optional from typing import Optional
import archspec.cpu import _vendoring.archspec.cpu
import llnl.util.lang import llnl.util.lang
@ -38,15 +38,15 @@ def __init__(self, name):
self.name = name self.name = name
self._init_targets() self._init_targets()
def add_target(self, name: str, target: archspec.cpu.Microarchitecture) -> None: def add_target(self, name: str, target: _vendoring.archspec.cpu.Microarchitecture) -> None:
if name in Platform.reserved_targets: if name in Platform.reserved_targets:
msg = f"{name} is a spack reserved alias and cannot be the name of a target" msg = f"{name} is a spack reserved alias and cannot be the name of a target"
raise ValueError(msg) raise ValueError(msg)
self.targets[name] = target self.targets[name] = target
def _init_targets(self): def _init_targets(self):
self.default = archspec.cpu.host().name self.default = _vendoring.archspec.cpu.host().name
for name, microarchitecture in archspec.cpu.TARGETS.items(): for name, microarchitecture in _vendoring.archspec.cpu.TARGETS.items():
self.add_target(name, microarchitecture) self.add_target(name, microarchitecture)
def target(self, name): def target(self, name):

View File

@ -3,7 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform import platform
import archspec.cpu import _vendoring.archspec.cpu
import spack.operating_systems import spack.operating_systems
@ -28,7 +28,7 @@ def __init__(self, name=None):
def _init_targets(self): def _init_targets(self):
targets = ("aarch64", "m1") if platform.machine() == "arm64" else ("x86_64", "core2") targets = ("aarch64", "m1") if platform.machine() == "arm64" else ("x86_64", "core2")
for t in targets: for t in targets:
self.add_target(t, archspec.cpu.TARGETS[t]) self.add_target(t, _vendoring.archspec.cpu.TARGETS[t])
@classmethod @classmethod
def detect(cls): def detect(cls):

View File

@ -34,7 +34,7 @@
Union, Union,
) )
import archspec.cpu import _vendoring.archspec.cpu
import llnl.util.lang import llnl.util.lang
import llnl.util.tty as tty import llnl.util.tty as tty
@ -1617,7 +1617,7 @@ def target_ranges(self, spec, single_target_fn):
target = spec.architecture.target target = spec.architecture.target
# Check if the target is a concrete target # Check if the target is a concrete target
if str(target) in archspec.cpu.TARGETS: if str(target) in _vendoring.archspec.cpu.TARGETS:
return [single_target_fn(spec.name, target)] return [single_target_fn(spec.name, target)]
self.target_constraints.add(target) self.target_constraints.add(target)
@ -2753,7 +2753,7 @@ def _supported_targets(self, compiler_name, compiler_version, targets):
compiler_name, compiler_version.dotted_numeric_string compiler_name, compiler_version.dotted_numeric_string
) )
supported.append(target) supported.append(target)
except archspec.cpu.UnsupportedMicroarchitecture: except _vendoring.archspec.cpu.UnsupportedMicroarchitecture:
continue continue
except ValueError: except ValueError:
continue continue
@ -2818,7 +2818,7 @@ def target_defaults(self, specs):
if not spec.architecture or not spec.architecture.target: if not spec.architecture or not spec.architecture.target:
continue continue
target = archspec.cpu.TARGETS.get(spec.target.name) target = _vendoring.archspec.cpu.TARGETS.get(spec.target.name)
if not target: if not target:
self.target_ranges(spec, None) self.target_ranges(spec, None)
continue continue
@ -2830,7 +2830,7 @@ def target_defaults(self, specs):
candidate_targets.append(ancestor) candidate_targets.append(ancestor)
platform = spack.platforms.host() platform = spack.platforms.host()
uarch = archspec.cpu.TARGETS.get(platform.default) uarch = _vendoring.archspec.cpu.TARGETS.get(platform.default)
best_targets = {uarch.family.name} best_targets = {uarch.family.name}
for compiler in self.possible_compilers: for compiler in self.possible_compilers:
supported = self._supported_targets(compiler.name, compiler.version, candidate_targets) supported = self._supported_targets(compiler.name, compiler.version, candidate_targets)
@ -2938,7 +2938,7 @@ def _all_targets_satisfiying(single_constraint):
return [single_constraint] return [single_constraint]
t_min, _, t_max = single_constraint.partition(":") t_min, _, t_max = single_constraint.partition(":")
for test_target in archspec.cpu.TARGETS.values(): for test_target in _vendoring.archspec.cpu.TARGETS.values():
# Check lower bound # Check lower bound
if t_min and not t_min <= test_target: if t_min and not t_min <= test_target:
continue continue

View File

@ -5,7 +5,7 @@
import collections import collections
from typing import Dict, List, NamedTuple, Set, Tuple, Union from typing import Dict, List, NamedTuple, Set, Tuple, Union
import archspec.cpu import _vendoring.archspec.cpu
from llnl.util import lang, tty from llnl.util import lang, tty
@ -34,7 +34,7 @@ def unreachable(self, *, pkg_name: str, when_spec: spack.spec.Spec) -> bool:
""" """
raise NotImplementedError raise NotImplementedError
def candidate_targets(self) -> List[archspec.cpu.Microarchitecture]: def candidate_targets(self) -> List[_vendoring.archspec.cpu.Microarchitecture]:
"""Returns a list of targets that are candidate for concretization""" """Returns a list of targets that are candidate for concretization"""
raise NotImplementedError raise NotImplementedError
@ -70,7 +70,7 @@ def __init__(self, *, configuration: spack.config.Configuration, repo: spack.rep
self.configuration = configuration self.configuration = configuration
self.repo = repo self.repo = repo
self._platform_condition = spack.spec.Spec( self._platform_condition = spack.spec.Spec(
f"platform={spack.platforms.host()} target={archspec.cpu.host().family}:" f"platform={spack.platforms.host()} target={_vendoring.archspec.cpu.host().family}:"
) )
try: try:
@ -110,10 +110,10 @@ def unreachable(self, *, pkg_name: str, when_spec: spack.spec.Spec) -> bool:
""" """
return False return False
def candidate_targets(self) -> List[archspec.cpu.Microarchitecture]: def candidate_targets(self) -> List[_vendoring.archspec.cpu.Microarchitecture]:
"""Returns a list of targets that are candidate for concretization""" """Returns a list of targets that are candidate for concretization"""
platform = spack.platforms.host() platform = spack.platforms.host()
default_target = archspec.cpu.TARGETS[platform.default] default_target = _vendoring.archspec.cpu.TARGETS[platform.default]
# Construct the list of targets which are compatible with the host # Construct the list of targets which are compatible with the host
candidate_targets = [default_target] + default_target.ancestors candidate_targets = [default_target] + default_target.ancestors
@ -125,7 +125,7 @@ def candidate_targets(self) -> List[archspec.cpu.Microarchitecture]:
additional_targets_in_family = sorted( additional_targets_in_family = sorted(
[ [
t t
for t in archspec.cpu.TARGETS.values() for t in _vendoring.archspec.cpu.TARGETS.values()
if (t.family.name == default_target.family.name and t not in candidate_targets) if (t.family.name == default_target.family.name and t not in candidate_targets)
], ],
key=lambda x: len(x.ancestors), key=lambda x: len(x.ancestors),

View File

@ -74,10 +74,9 @@
overload, overload,
) )
import _vendoring.archspec.cpu
from _vendoring.typing_extensions import Literal from _vendoring.typing_extensions import Literal
import archspec.cpu
import llnl.path import llnl.path
import llnl.string import llnl.string
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
@ -217,10 +216,12 @@ def ensure_modern_format_string(fmt: str) -> None:
) )
def _make_microarchitecture(name: str) -> archspec.cpu.Microarchitecture: def _make_microarchitecture(name: str) -> _vendoring.archspec.cpu.Microarchitecture:
if isinstance(name, archspec.cpu.Microarchitecture): if isinstance(name, _vendoring.archspec.cpu.Microarchitecture):
return name return name
return archspec.cpu.TARGETS.get(name, archspec.cpu.generic_microarchitecture(name)) return _vendoring.archspec.cpu.TARGETS.get(
name, _vendoring.archspec.cpu.generic_microarchitecture(name)
)
@lang.lazy_lexicographic_ordering @lang.lazy_lexicographic_ordering
@ -364,7 +365,7 @@ def target(self, value):
# will assumed to be the host machine's platform. # will assumed to be the host machine's platform.
def target_or_none(t): def target_or_none(t):
if isinstance(t, archspec.cpu.Microarchitecture): if isinstance(t, _vendoring.archspec.cpu.Microarchitecture):
return t return t
if t and t != "None": if t and t != "None":
return _make_microarchitecture(t) return _make_microarchitecture(t)

View File

@ -3,10 +3,9 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform import platform
import _vendoring.archspec.cpu
import pytest import pytest
import archspec.cpu
import spack.concretize import spack.concretize
import spack.operating_systems import spack.operating_systems
import spack.platforms import spack.platforms
@ -125,7 +124,8 @@ def test_satisfy_strict_constraint_when_not_concrete(architecture_tuple, constra
) )
@pytest.mark.usefixtures("mock_packages", "config") @pytest.mark.usefixtures("mock_packages", "config")
@pytest.mark.skipif( @pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="tests are for x86_64 uarch ranges" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="tests are for x86_64 uarch ranges",
) )
def test_concretize_target_ranges(root_target_range, dep_target_range, result, monkeypatch): def test_concretize_target_ranges(root_target_range, dep_target_range, result, monkeypatch):
spec = spack.concretize.concretize_one( spec = spack.concretize.concretize_one(

View File

@ -8,10 +8,9 @@
import sys import sys
from typing import Dict, Optional, Tuple from typing import Dict, Optional, Tuple
import _vendoring.archspec.cpu
import pytest import pytest
import archspec.cpu
from llnl.path import Path, convert_to_platform_path from llnl.path import Path, convert_to_platform_path
from llnl.util.filesystem import HeaderList, LibraryList from llnl.util.filesystem import HeaderList, LibraryList
@ -727,14 +726,15 @@ def test_rpath_with_duplicate_link_deps():
@pytest.mark.filterwarnings("ignore:microarchitecture specific") @pytest.mark.filterwarnings("ignore:microarchitecture specific")
@pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper") @pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper")
def test_optimization_flags(compiler_spec, target_name, expected_flags, compiler_factory): def test_optimization_flags(compiler_spec, target_name, expected_flags, compiler_factory):
target = archspec.cpu.TARGETS[target_name] target = _vendoring.archspec.cpu.TARGETS[target_name]
compiler = spack.spec.parse_with_version_concrete(compiler_spec) compiler = spack.spec.parse_with_version_concrete(compiler_spec)
opt_flags = spack.build_environment.optimization_flags(compiler, target) opt_flags = spack.build_environment.optimization_flags(compiler, target)
assert opt_flags == expected_flags assert opt_flags == expected_flags
@pytest.mark.skipif( @pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="tests check specific x86_64 uarch flags" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="tests check specific x86_64 uarch flags",
) )
@pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper") @pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper")
def test_optimization_flags_are_using_node_target(default_mock_concretization, monkeypatch): def test_optimization_flags_are_using_node_target(default_mock_concretization, monkeypatch):

View File

@ -5,11 +5,10 @@
import glob import glob
import os import os
import _vendoring.archspec.cpu
import py.path import py.path
import pytest import pytest
import archspec.cpu
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
import spack import spack
@ -217,7 +216,8 @@ def test_autotools_gnuconfig_replacement_disabled(self, mutable_database):
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
@pytest.mark.skipif( @pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="test data is specific for x86_64" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="test data is specific for x86_64",
) )
def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database, monkeypatch): def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database, monkeypatch):
""" """

View File

@ -4,10 +4,9 @@
import os import os
import _vendoring.archspec.cpu
import pytest import pytest
import archspec.cpu
import spack.concretize import spack.concretize
import spack.config import spack.config
import spack.paths import spack.paths
@ -86,7 +85,8 @@ def test_external_nodes_do_not_have_runtimes(runtime_repo, mutable_config, tmp_p
{"pkg-a": "gcc-runtime@9.4.0", "pkg-b": "gcc-runtime@9.4.0"}, {"pkg-a": "gcc-runtime@9.4.0", "pkg-b": "gcc-runtime@9.4.0"},
1, 1,
marks=pytest.mark.skipif( marks=pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="test data is x86_64 specific" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="test data is x86_64 specific",
), ),
), ),
pytest.param( pytest.param(
@ -98,7 +98,8 @@ def test_external_nodes_do_not_have_runtimes(runtime_repo, mutable_config, tmp_p
}, },
2, 2,
marks=pytest.mark.skipif( marks=pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="test data is x86_64 specific" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="test data is x86_64 specific",
), ),
), ),
], ],

View File

@ -6,11 +6,10 @@
import platform import platform
import sys import sys
import _vendoring.archspec.cpu
import _vendoring.jinja2 import _vendoring.jinja2
import pytest import pytest
import archspec.cpu
import llnl.util.lang import llnl.util.lang
import spack.binary_distribution import spack.binary_distribution
@ -146,12 +145,12 @@ def current_host(request, monkeypatch):
monkeypatch.setattr(spack.platforms.Test, "default", cpu) monkeypatch.setattr(spack.platforms.Test, "default", cpu)
if not is_preference: if not is_preference:
target = archspec.cpu.TARGETS[cpu] target = _vendoring.archspec.cpu.TARGETS[cpu]
monkeypatch.setattr(archspec.cpu, "host", lambda: target) monkeypatch.setattr(_vendoring.archspec.cpu, "host", lambda: target)
yield target yield target
else: else:
target = archspec.cpu.TARGETS["sapphirerapids"] target = _vendoring.archspec.cpu.TARGETS["sapphirerapids"]
monkeypatch.setattr(archspec.cpu, "host", lambda: target) monkeypatch.setattr(_vendoring.archspec.cpu, "host", lambda: target)
with spack.config.override("packages:all", {"target": [cpu]}): with spack.config.override("packages:all", {"target": [cpu]}):
yield target yield target
@ -383,7 +382,7 @@ def test_different_compilers_get_different_flags(
"gcc": {"externals": [gcc11_with_flags]}, "gcc": {"externals": [gcc11_with_flags]},
}, },
) )
t = archspec.cpu.host().family t = _vendoring.archspec.cpu.host().family
client = spack.concretize.concretize_one( client = spack.concretize.concretize_one(
Spec( Spec(
f"cmake-client platform=test os=redhat6 target={t} %gcc@11.1.0" f"cmake-client platform=test os=redhat6 target={t} %gcc@11.1.0"
@ -976,7 +975,7 @@ def test_noversion_pkg(self, spec):
def test_adjusting_default_target_based_on_compiler( def test_adjusting_default_target_based_on_compiler(
self, spec, compiler_spec, best_achievable, current_host, compiler_factory, mutable_config self, spec, compiler_spec, best_achievable, current_host, compiler_factory, mutable_config
): ):
best_achievable = archspec.cpu.TARGETS[best_achievable] best_achievable = _vendoring.archspec.cpu.TARGETS[best_achievable]
expected = best_achievable if best_achievable < current_host else current_host expected = best_achievable if best_achievable < current_host else current_host
mutable_config.set( mutable_config.set(
"packages", {"gcc": {"externals": [compiler_factory(spec=f"{compiler_spec}")]}} "packages", {"gcc": {"externals": [compiler_factory(spec=f"{compiler_spec}")]}}
@ -1645,7 +1644,7 @@ def test_target_granularity(self):
# The test architecture uses core2 as the default target. Check that when # The test architecture uses core2 as the default target. Check that when
# we configure Spack for "generic" granularity we concretize for x86_64 # we configure Spack for "generic" granularity we concretize for x86_64
default_target = spack.platforms.test.Test.default default_target = spack.platforms.test.Test.default
generic_target = archspec.cpu.TARGETS[default_target].generic.name generic_target = _vendoring.archspec.cpu.TARGETS[default_target].generic.name
s = Spec("python") s = Spec("python")
assert spack.concretize.concretize_one(s).satisfies("target=%s" % default_target) assert spack.concretize.concretize_one(s).satisfies("target=%s" % default_target)
with spack.config.override("concretizer:targets", {"granularity": "generic"}): with spack.config.override("concretizer:targets", {"granularity": "generic"}):
@ -2011,7 +2010,7 @@ def test_installed_specs_disregard_conflicts(self, mutable_database, monkeypatch
def test_require_targets_are_allowed(self, mutable_config, mutable_database): def test_require_targets_are_allowed(self, mutable_config, mutable_database):
"""Test that users can set target constraints under the require attribute.""" """Test that users can set target constraints under the require attribute."""
# Configuration to be added to packages.yaml # Configuration to be added to packages.yaml
required_target = archspec.cpu.TARGETS[spack.platforms.test.Test.default].family required_target = _vendoring.archspec.cpu.TARGETS[spack.platforms.test.Test.default].family
external_conf = {"all": {"require": f"target={required_target}"}} external_conf = {"all": {"require": f"target={required_target}"}}
mutable_config.set("packages", external_conf) mutable_config.set("packages", external_conf)

View File

@ -20,13 +20,12 @@
import tempfile import tempfile
import xml.etree.ElementTree import xml.etree.ElementTree
import _vendoring.archspec.cpu
import _vendoring.archspec.cpu.microarchitecture
import _vendoring.archspec.cpu.schema
import py import py
import pytest import pytest
import archspec.cpu
import archspec.cpu.microarchitecture
import archspec.cpu.schema
import llnl.util.lang import llnl.util.lang
import llnl.util.lock import llnl.util.lock
import llnl.util.tty as tty import llnl.util.tty as tty
@ -372,12 +371,12 @@ def clean_test_environment():
def _host(): def _host():
"""Mock archspec host so there is no inconsistency on the Windows platform """Mock archspec host so there is no inconsistency on the Windows platform
This function cannot be local as it needs to be pickleable""" This function cannot be local as it needs to be pickleable"""
return archspec.cpu.Microarchitecture("x86_64", [], "generic", [], {}, 0) return _vendoring.archspec.cpu.Microarchitecture("x86_64", [], "generic", [], {}, 0)
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def archspec_host_is_spack_test_host(monkeypatch): def archspec_host_is_spack_test_host(monkeypatch):
monkeypatch.setattr(archspec.cpu, "host", _host) monkeypatch.setattr(_vendoring.archspec.cpu, "host", _host)
# Hooks to add command line options or set other custom behaviors. # Hooks to add command line options or set other custom behaviors.
@ -728,14 +727,14 @@ def mock_uarch_json(tmpdir_factory):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def mock_uarch_configuration(mock_uarch_json): def mock_uarch_configuration(mock_uarch_json):
"""Create mock dictionaries for the archspec.cpu.""" """Create mock dictionaries for the _vendoring.archspec.cpu."""
def load_json(): def load_json():
with open(mock_uarch_json, encoding="utf-8") as f: with open(mock_uarch_json, encoding="utf-8") as f:
return json.load(f) return json.load(f)
targets_json = load_json() targets_json = load_json()
targets = archspec.cpu.microarchitecture._known_microarchitectures() targets = _vendoring.archspec.cpu.microarchitecture._known_microarchitectures()
yield targets_json, targets yield targets_json, targets
@ -744,8 +743,8 @@ def load_json():
def mock_targets(mock_uarch_configuration, monkeypatch): def mock_targets(mock_uarch_configuration, monkeypatch):
"""Use this fixture to enable mock uarch targets for testing.""" """Use this fixture to enable mock uarch targets for testing."""
targets_json, targets = mock_uarch_configuration targets_json, targets = mock_uarch_configuration
monkeypatch.setattr(archspec.cpu.schema, "TARGETS_JSON", targets_json) monkeypatch.setattr(_vendoring.archspec.cpu.schema, "TARGETS_JSON", targets_json)
monkeypatch.setattr(archspec.cpu.microarchitecture, "TARGETS", targets) monkeypatch.setattr(_vendoring.archspec.cpu.microarchitecture, "TARGETS", targets)
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
@ -773,7 +772,7 @@ def configuration_dir(tmpdir_factory, linux_os):
config_template = test_config / "config.yaml" config_template = test_config / "config.yaml"
config.write(config_template.read_text().format(install_tree_root, locks)) config.write(config_template.read_text().format(install_tree_root, locks))
target = str(archspec.cpu.host().family) target = str(_vendoring.archspec.cpu.host().family)
compilers = tmpdir.join("site", "packages.yaml") compilers = tmpdir.join("site", "packages.yaml")
compilers_template = test_config / "packages.yaml" compilers_template = test_config / "packages.yaml"
compilers.write(compilers_template.read_text().format(linux_os=linux_os, target=target)) compilers.write(compilers_template.read_text().format(linux_os=linux_os, target=target))
@ -2117,7 +2116,7 @@ def _factory(*, spec):
@pytest.fixture() @pytest.fixture()
def host_architecture_str(): def host_architecture_str():
"""Returns the broad architecture family (x86_64, aarch64, etc.)""" """Returns the broad architecture family (x86_64, aarch64, etc.)"""
return str(archspec.cpu.host().family) return str(_vendoring.archspec.cpu.host().family)
def _true(x): def _true(x):

View File

@ -11,10 +11,9 @@
import json import json
import os import os
import _vendoring.archspec.cpu
import pytest import pytest
import archspec.cpu
import spack import spack
import spack.cmd import spack.cmd
import spack.cmd.external import spack.cmd.external
@ -104,7 +103,7 @@ def spec_json(self):
@pytest.fixture @pytest.fixture
def _common_arch(test_platform): def _common_arch(test_platform):
generic = archspec.cpu.TARGETS[test_platform.default].family generic = _vendoring.archspec.cpu.TARGETS[test_platform.default].family
return JsonArchEntry(platform=test_platform.name, os="redhat6", target=generic.name) return JsonArchEntry(platform=test_platform.name, os="redhat6", target=generic.name)

View File

@ -4,10 +4,9 @@
import os import os
import _vendoring.archspec.cpu
import pytest import pytest
import archspec.cpu
import spack.concretize import spack.concretize
import spack.config import spack.config
import spack.environment as ev import spack.environment as ev
@ -221,7 +220,8 @@ def test_setenv_raw_value(self, modulefile_content, module_configuration):
assert len([x for x in content if 'setenv("FOO", "{{name}}, {name}, {{}}, {}")' in x]) == 1 assert len([x for x in content if 'setenv("FOO", "{{name}}, {name}, {{}}, {}")' in x]) == 1
@pytest.mark.skipif( @pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="test data is specific for x86_64" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="test data is specific for x86_64",
) )
def test_help_message(self, modulefile_content, module_configuration): def test_help_message(self, modulefile_content, module_configuration):
"""Tests the generation of module help message.""" """Tests the generation of module help message."""

View File

@ -4,10 +4,9 @@
import os import os
import _vendoring.archspec.cpu
import pytest import pytest
import archspec.cpu
import spack.concretize import spack.concretize
import spack.modules.common import spack.modules.common
import spack.modules.tcl import spack.modules.tcl
@ -186,7 +185,8 @@ def test_setenv_raw_value(self, modulefile_content, module_configuration):
assert len([x for x in content if "setenv FOO {{{name}}, {name}, {{}}, {}}" in x]) == 1 assert len([x for x in content if "setenv FOO {{{name}}, {name}, {{}}, {}}" in x]) == 1
@pytest.mark.skipif( @pytest.mark.skipif(
str(archspec.cpu.host().family) != "x86_64", reason="test data is specific for x86_64" str(_vendoring.archspec.cpu.host().family) != "x86_64",
reason="test data is specific for x86_64",
) )
def test_help_message(self, modulefile_content, module_configuration): def test_help_message(self, modulefile_content, module_configuration):
"""Tests the generation of module help message.""" """Tests the generation of module help message."""

View File

@ -75,7 +75,6 @@ section-order = [
"future", "future",
"standard-library", "standard-library",
"third-party", "third-party",
"archspec",
"llnl", "llnl",
"spack", "spack",
"first-party", "first-party",
@ -84,7 +83,6 @@ section-order = [
[tool.ruff.lint.isort.sections] [tool.ruff.lint.isort.sections]
spack = ["spack"] spack = ["spack"]
archspec = ["archspec"]
llnl = ["llnl"] llnl = ["llnl"]
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
@ -104,13 +102,11 @@ sections = [
"FUTURE", "FUTURE",
"STDLIB", "STDLIB",
"THIRDPARTY", "THIRDPARTY",
"ARCHSPEC",
"LLNL", "LLNL",
"FIRSTPARTY", "FIRSTPARTY",
"LOCALFOLDER", "LOCALFOLDER",
] ]
known_first_party = "spack" known_first_party = "spack"
known_archspec = "archspec"
known_llnl = "llnl" known_llnl = "llnl"
known_third_party = ["ruamel", "six"] known_third_party = ["ruamel", "six"]
src_paths = "lib" src_paths = "lib"
@ -264,6 +260,9 @@ 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
@ -285,11 +284,21 @@ drop = [
"pvectorc.*.so", "pvectorc.*.so",
# Trim jsonschema tests # Trim jsonschema tests
"jsonschema/tests", "jsonschema/tests",
"archspec/json/tests",
"archspec/vendor/cpuid/.gitignore",
"pyrsistent/__init__.pyi",
] ]
[tool.vendoring.typing-stubs] [tool.vendoring.typing-stubs]
six = ["six.__init__", "six.moves.__init__", "six.moves.configparser"] _pyrsistent_version = []
altgraph = []
archspec = []
distro = [] distro = []
jsonschema = []
macholib = []
pyrsistent = []
ruamel = []
six = []
[tool.vendoring.license.directories] [tool.vendoring.license.directories]
setuptools = "pkg_resources" setuptools = "pkg_resources"

View File

@ -10,7 +10,7 @@
import stat import stat
from typing import Dict, Iterable, List, Mapping, Optional, Tuple from typing import Dict, Iterable, List, Mapping, Optional, Tuple
import archspec import _vendoring.archspec.cpu
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
from llnl.util.lang import ClassProperty, classproperty, match_predicate from llnl.util.lang import ClassProperty, classproperty, match_predicate
@ -286,7 +286,7 @@ def _update_external_dependencies(self, extendee_spec: Optional[Spec] = None) ->
if not python.architecture.os: if not python.architecture.os:
python.architecture.os = platform.default_operating_system() python.architecture.os = platform.default_operating_system()
if not python.architecture.target: if not python.architecture.target:
python.architecture.target = archspec.cpu.host().family.name python.architecture.target = _vendoring.archspec.cpu.host().family.name
python.external_path = self.spec.external_path python.external_path = self.spec.external_path
python._mark_concrete() python._mark_concrete()

View File

@ -6,10 +6,9 @@
import sys import sys
from typing import List from typing import List
import _vendoring.archspec.cpu
from spack_repo.builtin.build_systems.generic import Package from spack_repo.builtin.build_systems.generic import Package
import archspec.cpu
from llnl.util import lang from llnl.util import lang
import spack.compilers.libraries import spack.compilers.libraries
@ -183,12 +182,12 @@ def setup_dependent_build_environment(
env.set(f"SPACK_{wrapper_var_name}_RPATH_ARG", compiler_pkg.rpath_arg) env.set(f"SPACK_{wrapper_var_name}_RPATH_ARG", compiler_pkg.rpath_arg)
uarch = dependent_spec.architecture.target uarch = dependent_spec.architecture.target
version_number, _ = archspec.cpu.version_components( version_number, _ = _vendoring.archspec.cpu.version_components(
compiler_pkg.spec.version.dotted_numeric_string compiler_pkg.spec.version.dotted_numeric_string
) )
try: try:
isa_arg = uarch.optimization_flags(compiler_pkg.archspec_name(), version_number) isa_arg = uarch.optimization_flags(compiler_pkg.archspec_name(), version_number)
except (ValueError, archspec.cpu.UnsupportedMicroarchitecture): except (ValueError, _vendoring.archspec.cpu.UnsupportedMicroarchitecture):
isa_arg = "" isa_arg = ""
if isa_arg: if isa_arg:

View File

@ -10,7 +10,7 @@
import stat import stat
from typing import Dict, Iterable, List, Mapping, Optional, Tuple from typing import Dict, Iterable, List, Mapping, Optional, Tuple
import archspec import _vendoring.archspec
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
import llnl.util.tty as tty import llnl.util.tty as tty
@ -276,7 +276,7 @@ def _update_external_dependencies(self, extendee_spec=None):
if not python.architecture.os: if not python.architecture.os:
python.architecture.os = platform.default_operating_system() python.architecture.os = platform.default_operating_system()
if not python.architecture.target: if not python.architecture.target:
python.architecture.target = archspec.cpu.host().family.name python.architecture.target = _vendoring.archspec.cpu.host().family.name
python.external_path = self.spec.external_path python.external_path = self.spec.external_path
python._mark_concrete() python._mark_concrete()

View File

@ -6,10 +6,9 @@
import sys import sys
from typing import List from typing import List
import _vendoring.archspec.cpu
from spack_repo.builtin_mock.build_systems.generic import Package from spack_repo.builtin_mock.build_systems.generic import Package
import archspec.cpu
from llnl.util import lang from llnl.util import lang
import spack.compilers.libraries import spack.compilers.libraries
@ -184,12 +183,12 @@ def setup_dependent_build_environment(
env.set(f"SPACK_{wrapper_var_name}_RPATH_ARG", compiler_pkg.rpath_arg) env.set(f"SPACK_{wrapper_var_name}_RPATH_ARG", compiler_pkg.rpath_arg)
uarch = dependent_spec.architecture.target uarch = dependent_spec.architecture.target
version_number, _ = archspec.cpu.version_components( version_number, _ = _vendoring.archspec.cpu.version_components(
compiler_pkg.spec.version.dotted_numeric_string compiler_pkg.spec.version.dotted_numeric_string
) )
try: try:
isa_arg = uarch.optimization_flags(compiler_pkg.archspec_name(), version_number) isa_arg = uarch.optimization_flags(compiler_pkg.archspec_name(), version_number)
except (ValueError, archspec.cpu.UnsupportedMicroarchitecture): except ValueError:
isa_arg = "" isa_arg = ""
if isa_arg: if isa_arg: