Compare commits

..

4 Commits

Author SHA1 Message Date
Harmen Stoppels
f7fc421283 fix 2025-01-08 18:23:40 +01:00
Harmen Stoppels
7e31e4a4a6 fix docs 2025-01-08 14:03:23 +01:00
Harmen Stoppels
98db2b9e76 jsonschema.exceptions 2025-01-08 13:51:40 +01:00
Harmen Stoppels
b68c331bac config: report file:line of deprecated config items 2025-01-08 13:17:18 +01:00
90 changed files with 1024 additions and 1121 deletions

View File

@@ -29,7 +29,7 @@ jobs:
- run: coverage xml
- name: "Upload coverage report to CodeCov"
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303
uses: codecov/codecov-action@05f5a9cfad807516dbbef9929c4a42df3eb78766
with:
verbose: true
fail_ci_if_error: false

View File

@@ -2,6 +2,6 @@ black==24.10.0
clingo==5.7.1
flake8==7.1.1
isort==5.13.2
mypy==1.11.2
mypy==1.8.0
types-six==1.17.0.20241205
vermin==1.6.0

View File

@@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: '3.13'
python-version: '3.11'
cache: 'pip'
- name: Install Python Packages
run: |
@@ -39,7 +39,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: '3.13'
python-version: '3.11'
cache: 'pip'
- name: Install Python packages
run: |
@@ -58,7 +58,7 @@ jobs:
secrets: inherit
with:
with_coverage: ${{ inputs.with_coverage }}
python_version: '3.13'
python_version: '3.11'
# Check that spack can bootstrap the development environment on Python 3.6 - RHEL8
bootstrap-dev-rhel8:
runs-on: ubuntu-latest

View File

@@ -206,6 +206,7 @@ def setup(sphinx):
("py:class", "TextIO"),
("py:class", "hashlib._Hash"),
("py:class", "concurrent.futures._base.Executor"),
("py:class", "jsonschema.exceptions.ValidationError"),
# Spack classes that are private and we don't want to expose
("py:class", "spack.provider_index._IndexBase"),
("py:class", "spack.repo._PrependFileLoader"),

View File

@@ -25,23 +25,14 @@ These settings can be overridden in ``etc/spack/config.yaml`` or
The location where Spack will install packages and their dependencies.
Default is ``$spack/opt/spack``.
---------------
``projections``
---------------
---------------------------------------------------
``install_hash_length`` and ``install_path_scheme``
---------------------------------------------------
.. warning::
Modifying projections of the install tree is strongly discouraged.
By default Spack installs all packages into a unique directory relative to the install
tree root with the following layout:
.. code-block::
{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}
In very rare cases, it may be necessary to reduce the length of this path. For example,
very old versions of the Intel compiler are known to segfault when input paths are too long:
The default Spack installation path can be very long and can create problems
for scripts with hardcoded shebangs. Additionally, when using the Intel
compiler, and if there is also a long list of dependencies, the compiler may
segfault. If you see the following:
.. code-block:: console
@@ -49,25 +40,36 @@ very old versions of the Intel compiler are known to segfault when input paths a
** Segmentation violation signal raised. **
Access violation or stack overflow. Please contact Intel Support for assistance.
Another case is Python and R packages with many runtime dependencies, which can result
in very large ``PYTHONPATH`` and ``R_LIBS`` environment variables. This can cause the
``execve`` system call to fail with ``E2BIG``, preventing processes from starting.
it may be because variables containing dependency specs may be too long. There
are two parameters to help with long path names. Firstly, the
``install_hash_length`` parameter can set the length of the hash in the
installation path from 1 to 32. The default path uses the full 32 characters.
For this reason, Spack allows users to modify the installation layout through custom
projections. For example
Secondly, it is also possible to modify the entire installation
scheme. By default Spack uses
``{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}``
where the tokens that are available for use in this directive are the
same as those understood by the :meth:`~spack.spec.Spec.format`
method. Using this parameter it is possible to use a different package
layout or reduce the depth of the installation paths. For example
.. code-block:: yaml
config:
install_tree:
root: $spack/opt/spack
projections:
all: "{name}/{version}/{hash:16}"
install_path_scheme: '{name}/{version}/{hash:7}'
would install packages into sub-directories using only the package name, version and a
hash length of 16 characters.
would install packages into sub-directories using only the package
name, version and a hash length of 7 characters.
Notice that reducing the hash length increases the likelihood of hash collisions.
When using either parameter to set the hash length it only affects the
representation of the hash in the installation directory. You
should be aware that the smaller the hash length the more likely
naming conflicts will occur. These parameters are independent of those
used to configure module names.
.. warning:: Modifying the installation hash length or path scheme after
packages have been installed will prevent Spack from being
able to find the old installation directories.
--------------------
``build_stage``

View File

@@ -4,7 +4,7 @@ sphinx_design==0.6.1
sphinx-rtd-theme==3.0.2
python-levenshtein==0.26.1
docutils==0.21.2
pygments==2.19.1
pygments==2.18.0
urllib3==2.3.0
pytest==8.3.4
isort==5.13.2

View File

@@ -591,18 +591,32 @@ def file_matches(f: IO[bytes], regex: llnl.util.lang.PatternBytes) -> bool:
f.seek(0)
def specs_to_relocate(spec: spack.spec.Spec) -> List[spack.spec.Spec]:
"""Return the set of specs that may be referenced in the install prefix of the provided spec.
We currently include non-external transitive link and direct run dependencies."""
specs = [
def deps_to_relocate(spec):
"""Return the transitive link and direct run dependencies of the spec.
This is a special traversal for dependencies we need to consider when relocating a package.
Package binaries, scripts, and other files may refer to the prefixes of dependencies, so
we need to rewrite those locations when dependencies are in a different place at install time
than they were at build time.
This traversal covers transitive link dependencies and direct run dependencies because:
1. Spack adds RPATHs for transitive link dependencies so that packages can find needed
dependency libraries.
2. Packages may call any of their *direct* run dependencies (and may bake their paths into
binaries or scripts), so we also need to search for run dependency prefixes when relocating.
This returns a deduplicated list of transitive link dependencies and direct run dependencies.
"""
deps = [
s
for s in itertools.chain(
spec.traverse(root=True, deptype="link", order="breadth", key=traverse.by_dag_hash),
spec.dependencies(deptype="run"),
spec.traverse(root=True, deptype="link"), spec.dependencies(deptype="run")
)
if not s.external
]
return list(llnl.util.lang.dedupe(specs, key=lambda s: s.dag_hash()))
return llnl.util.lang.dedupe(deps, key=lambda s: s.dag_hash())
def get_buildinfo_dict(spec):
@@ -616,7 +630,7 @@ def get_buildinfo_dict(spec):
# "relocate_binaries": [],
# "relocate_links": [],
"hardlinks_deduped": True,
"hash_to_prefix": {d.dag_hash(): str(d.prefix) for d in specs_to_relocate(spec)},
"hash_to_prefix": {d.dag_hash(): str(d.prefix) for d in deps_to_relocate(spec)},
}
@@ -1098,7 +1112,7 @@ def _exists_in_buildcache(spec: spack.spec.Spec, tmpdir: str, out_url: str) -> E
def prefixes_to_relocate(spec):
prefixes = [s.prefix for s in specs_to_relocate(spec)]
prefixes = [s.prefix for s in deps_to_relocate(spec)]
prefixes.append(spack.hooks.sbang.sbang_install_path())
prefixes.append(str(spack.store.STORE.layout.root))
return prefixes
@@ -2175,12 +2189,7 @@ def relocate_package(spec):
old_spack_prefix = str(buildinfo.get("spackprefix"))
old_rel_prefix = buildinfo.get("relative_prefix")
old_prefix = os.path.join(old_layout_root, old_rel_prefix)
# Warn about old style tarballs created with the now removed --rel flag.
if buildinfo.get("relative_rpaths", False):
tty.warn(
f"Tarball for {spec} uses relative rpaths, " "which can cause library loading issues."
)
rel = buildinfo.get("relative_rpaths", False)
# In the past prefix_to_hash was the default and externals were not dropped, so prefixes
# were not unique.
@@ -2220,7 +2229,7 @@ def relocate_package(spec):
# An analog in this algorithm is any spec that shares a name or provides the same virtuals
# in the context of the relevant root spec. This ensures that the analog for a spec s
# is the spec that s replaced when we spliced.
relocation_specs = specs_to_relocate(spec)
relocation_specs = deps_to_relocate(spec)
build_spec_ids = set(id(s) for s in spec.build_spec.traverse(deptype=dt.ALL & ~dt.BUILD))
for s in relocation_specs:
analog = s
@@ -2258,11 +2267,19 @@ def relocate_package(spec):
tty.debug("Relocating package from", "%s to %s." % (old_layout_root, new_layout_root))
# Old archives may have hardlinks repeated.
# Old archives maybe have hardlinks repeated.
dedupe_hardlinks_if_necessary(workdir, buildinfo)
def is_backup_file(file):
return file.endswith("~")
# Text files containing the prefix text
text_names = [os.path.join(workdir, f) for f in buildinfo["relocate_textfiles"]]
text_names = list()
for filename in buildinfo["relocate_textfiles"]:
text_name = os.path.join(workdir, filename)
# Don't add backup files generated by filter_file during install step.
if not is_backup_file(text_name):
text_names.append(text_name)
# If we are not installing back to the same install tree do the relocation
if old_prefix != new_prefix:
@@ -2273,11 +2290,29 @@ def relocate_package(spec):
# do the relocation of path in binaries
platform = spack.platforms.by_name(spec.platform)
if "macho" in platform.binary_formats:
relocate.relocate_macho_binaries(files_to_relocate, prefix_to_prefix_bin)
elif "elf" in platform.binary_formats:
relocate.relocate_macho_binaries(
files_to_relocate,
old_layout_root,
new_layout_root,
prefix_to_prefix_bin,
rel,
old_prefix,
new_prefix,
)
elif "elf" in platform.binary_formats and not rel:
# The new ELF dynamic section relocation logic only handles absolute to
# absolute relocation.
relocate.relocate_elf_binaries(files_to_relocate, prefix_to_prefix_bin)
relocate.new_relocate_elf_binaries(files_to_relocate, prefix_to_prefix_bin)
elif "elf" in platform.binary_formats and rel:
relocate.relocate_elf_binaries(
files_to_relocate,
old_layout_root,
new_layout_root,
prefix_to_prefix_bin,
rel,
old_prefix,
new_prefix,
)
# Relocate links to the new install prefix
links = [os.path.join(workdir, f) for f in buildinfo.get("relocate_links", [])]

View File

@@ -298,14 +298,7 @@ def initconfig_hardware_entries(self):
def std_initconfig_entries(self):
cmake_prefix_path_env = os.environ["CMAKE_PREFIX_PATH"]
cmake_prefix_path = cmake_prefix_path_env.replace(os.pathsep, ";")
complete_rpath_list = ";".join(
[
self.pkg.spec.prefix.lib,
self.pkg.spec.prefix.lib64,
*os.environ.get("SPACK_COMPILER_EXTRA_RPATHS", "").split(":"),
*os.environ.get("SPACK_COMPILER_IMPLICIT_RPATHS", "").split(":"),
]
)
return [
"#------------------{0}".format("-" * 60),
"# !!!! This is a generated file, edit at own risk !!!!",
@@ -314,8 +307,6 @@ def std_initconfig_entries(self):
"#------------------{0}\n".format("-" * 60),
cmake_cache_string("CMAKE_PREFIX_PATH", cmake_prefix_path),
cmake_cache_string("CMAKE_INSTALL_RPATH_USE_LINK_PATH", "ON"),
cmake_cache_string("CMAKE_BUILD_RPATH", complete_rpath_list),
cmake_cache_string("CMAKE_INSTALL_RPATH", complete_rpath_list),
self.define_cmake_cache_from_variant("CMAKE_BUILD_TYPE", "build_type"),
]

View File

@@ -10,9 +10,8 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
from spack.directives import build_system, depends_on, extends
from spack.directives import build_system, extends
from spack.install_test import SkipTest, test_part
from spack.multimethod import when
from spack.util.executable import Executable
from ._checks import BuilderWithDefaults, execute_build_time_tests
@@ -29,9 +28,7 @@ class PerlPackage(spack.package_base.PackageBase):
build_system("perl")
with when("build_system=perl"):
extends("perl")
depends_on("gmake", type="build")
extends("perl", when="build_system=perl")
@property
@memoized

View File

@@ -144,7 +144,7 @@ def is_installed(spec):
record = spack.store.STORE.db.query_local_by_spec_hash(spec.dag_hash())
return record and record.installed
all_specs = traverse.traverse_nodes(
specs = traverse.traverse_nodes(
specs,
root=False,
order="breadth",
@@ -155,7 +155,7 @@ def is_installed(spec):
)
with spack.store.STORE.db.read_transaction():
return [spec for spec in all_specs if is_installed(spec)]
return [spec for spec in specs if is_installed(spec)]
def dependent_environments(

View File

@@ -34,8 +34,11 @@
import os
import re
import sys
import warnings
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Union
import jsonschema
from llnl.util import filesystem, lang, tty
import spack.error
@@ -1048,7 +1051,6 @@ def validate(
This leverages the line information (start_mark, end_mark) stored
on Spack YAML structures.
"""
import jsonschema
try:
spack.schema.Validator(schema).validate(data)
@@ -1057,7 +1059,12 @@ def validate(
line_number = e.instance.lc.line + 1
else:
line_number = None
raise ConfigFormatError(e, data, filename, line_number) from e
exception = ConfigFormatError(e, data, filename, line_number)
if isinstance(e, spack.schema.NonFatalValidationError):
warnings.warn(str(exception))
else:
raise exception from e
# return the validated data so that we can access the raw data
# mostly relevant for environments
return data

View File

@@ -6,6 +6,8 @@
"""
import warnings
import jsonschema
import spack.environment as ev
import spack.schema.env as env
import spack.util.spack_yaml as syaml
@@ -30,7 +32,6 @@ def validate(configuration_file):
Returns:
A sanitized copy of the configuration stored in the input file
"""
import jsonschema
with open(configuration_file, encoding="utf-8") as f:
config = syaml.load(f)

View File

@@ -1330,7 +1330,7 @@ def deprecate(self, spec: "spack.spec.Spec", deprecator: "spack.spec.Spec") -> N
def installed_relatives(
self,
spec: "spack.spec.Spec",
direction: tr.DirectionType = "children",
direction: str = "children",
transitive: bool = True,
deptype: Union[dt.DepFlag, dt.DepTypes] = dt.ALL,
) -> Set["spack.spec.Spec"]:

View File

@@ -8,7 +8,7 @@
import shutil
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
from typing import List, Optional, Tuple
import llnl.util.filesystem as fs
from llnl.util.symlink import readlink
@@ -17,6 +17,7 @@
import spack.hash_types as ht
import spack.projections
import spack.spec
import spack.store
import spack.util.spack_json as sjson
from spack.error import SpackError
@@ -68,9 +69,10 @@ def specs_from_metadata_dirs(root: str) -> List["spack.spec.Spec"]:
class DirectoryLayout:
"""A directory layout is used to associate unique paths with specs. Different installations are
going to want different layouts for their install, and they can use this to customize the
nesting structure of spack installs. The default layout is:
"""A directory layout is used to associate unique paths with specs.
Different installations are going to want different layouts for their
install, and they can use this to customize the nesting structure of
spack installs. The default layout is:
* <install root>/
@@ -80,30 +82,35 @@ class DirectoryLayout:
* <name>-<version>-<hash>
The installation directory projections can be modified with the projections argument."""
The hash here is a SHA-1 hash for the full DAG plus the build
spec.
def __init__(
self,
root,
*,
projections: Optional[Dict[str, str]] = None,
hash_length: Optional[int] = None,
) -> None:
The installation directory projections can be modified with the
projections argument.
"""
def __init__(self, root, **kwargs):
self.root = root
projections = projections or default_projections
self.projections = {key: projection.lower() for key, projection in projections.items()}
self.check_upstream = True
projections = kwargs.get("projections") or default_projections
self.projections = dict(
(key, projection.lower()) for key, projection in projections.items()
)
# apply hash length as appropriate
self.hash_length = hash_length
self.hash_length = kwargs.get("hash_length", None)
if self.hash_length is not None:
for when_spec, projection in self.projections.items():
if "{hash}" not in projection:
raise InvalidDirectoryLayoutParametersError(
"Conflicting options for installation layout hash length"
if "{hash" in projection
else "Cannot specify hash length when the hash is not part of all "
"install_tree projections"
)
if "{hash" in projection:
raise InvalidDirectoryLayoutParametersError(
"Conflicting options for installation layout hash" " length"
)
else:
raise InvalidDirectoryLayoutParametersError(
"Cannot specify hash length when the hash is not"
" part of all install_tree projections"
)
self.projections[when_spec] = projection.replace(
"{hash}", "{hash:%d}" % self.hash_length
)
@@ -272,6 +279,13 @@ def path_for_spec(self, spec):
if spec.external:
return spec.external_path
if self.check_upstream:
upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash())
if upstream:
raise SpackError(
"Internal error: attempted to call path_for_spec on"
" upstream-installed package."
)
path = self.relative_path_for_spec(spec)
assert not path.startswith(self.root)

View File

@@ -2634,29 +2634,6 @@ def _ensure_env_dir():
shutil.copy(envfile, target_manifest)
# Copy relative path includes that live inside the environment dir
try:
manifest = EnvironmentManifestFile(environment_dir)
except Exception as e:
msg = f"cannot initialize environment, '{environment_dir}' from manifest"
raise SpackEnvironmentError(msg) from e
else:
includes = manifest[TOP_LEVEL_KEY].get("include", [])
for include in includes:
if os.path.isabs(include):
continue
abspath = pathlib.Path(os.path.normpath(environment_dir / include))
if not abspath.is_relative_to(environment_dir):
# Warn that we are not copying relative path
msg = "Spack will not copy relative include path from outside environment"
msg += f" directory: {include}"
tty.warn(msg)
continue
orig_abspath = os.path.normpath(envfile.parent / include)
shutil.copy(orig_abspath, abspath)
class EnvironmentManifestFile(collections.abc.Mapping):
"""Manages the in-memory representation of a manifest file, and its synchronization

View File

@@ -539,7 +539,7 @@ def dump_packages(spec: "spack.spec.Spec", path: str) -> None:
# Note that we copy them in as they are in the *install* directory
# NOT as they are in the repository, because we want a snapshot of
# how *this* particular build was done.
for node in spec.traverse(deptype="all"):
for node in spec.traverse(deptype=all):
if node is not spec:
# Locate the dependency package in the install tree and find
# its provenance information.

View File

@@ -503,7 +503,7 @@ def make_argument_parser(**kwargs):
return parser
def showwarning(message, category, filename, lineno, file=None, line=None):
def send_warning_to_tty(message, category, filename, lineno, file=None, line=None):
"""Redirects messages to tty.warn."""
if category is spack.error.SpackAPIWarning:
tty.warn(f"{filename}:{lineno}: {message}")
@@ -513,6 +513,9 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
def setup_main_options(args):
"""Configure spack globals based on the basic options."""
# Assign a custom function to show warnings
warnings.showwarning = send_warning_to_tty
# Set up environment based on args.
tty.set_verbose(args.verbose)
tty.set_debug(args.debug)
@@ -903,10 +906,9 @@ def _main(argv=None):
# main() is tricky to get right, so be careful where you put things.
#
# Things in this first part of `main()` should *not* require any
# configuration. This doesn't include much -- setting up the parser,
# configuration. This doesn't include much -- setting up th parser,
# restoring some key environment variables, very simple CLI options, etc.
# ------------------------------------------------------------------------
warnings.showwarning = showwarning
# Create a parser with a simple positional argument first. We'll
# lazily load the subcommand(s) we need later. This allows us to

View File

@@ -767,9 +767,6 @@ def __init__(self, spec):
self.win_rpath = fsys.WindowsSimulatedRPath(self)
super().__init__()
def __getitem__(self, key: str) -> "PackageBase":
return self.spec[key].package
@classmethod
def dependency_names(cls):
return _subkeys(cls.dependencies)

View File

@@ -54,11 +54,144 @@ def _patchelf() -> Optional[executable.Executable]:
return spack.bootstrap.ensure_patchelf_in_path_or_raise()
def _elf_rpaths_for(path):
"""Return the RPATHs for an executable or a library.
Args:
path (str): full path to the executable or library
Return:
RPATHs as a list of strings. Returns an empty array
on ELF parsing errors, or when the ELF file simply
has no rpaths.
"""
return elf.get_rpaths(path) or []
def _make_relative(reference_file, path_root, paths):
"""Return a list where any path in ``paths`` that starts with
``path_root`` is made relative to the directory in which the
reference file is stored.
After a path is made relative it is prefixed with the ``$ORIGIN``
string.
Args:
reference_file (str): file from which the reference directory
is computed
path_root (str): root of the relative paths
paths: (list) paths to be examined
Returns:
List of relative paths
"""
start_directory = os.path.dirname(reference_file)
pattern = re.compile(path_root)
relative_paths = []
for path in paths:
if pattern.match(path):
rel = os.path.relpath(path, start=start_directory)
path = os.path.join("$ORIGIN", rel)
relative_paths.append(path)
return relative_paths
def _normalize_relative_paths(start_path, relative_paths):
"""Normalize the relative paths with respect to the original path name
of the file (``start_path``).
The paths that are passed to this function existed or were relevant
on another filesystem, so os.path.abspath cannot be used.
A relative path may contain the signifier $ORIGIN. Assuming that
``start_path`` is absolute, this implies that the relative path
(relative to start_path) should be replaced with an absolute path.
Args:
start_path (str): path from which the starting directory
is extracted
relative_paths (str): list of relative paths as obtained by a
call to :ref:`_make_relative`
Returns:
List of normalized paths
"""
normalized_paths = []
pattern = re.compile(re.escape("$ORIGIN"))
start_directory = os.path.dirname(start_path)
for path in relative_paths:
if path.startswith("$ORIGIN"):
sub = pattern.sub(start_directory, path)
path = os.path.normpath(sub)
normalized_paths.append(path)
return normalized_paths
def _decode_macho_data(bytestring):
return bytestring.rstrip(b"\x00").decode("ascii")
def macho_find_paths(orig_rpaths, deps, idpath, prefix_to_prefix):
def macho_make_paths_relative(path_name, old_layout_root, rpaths, deps, idpath):
"""
Return a dictionary mapping the original rpaths to the relativized rpaths.
This dictionary is used to replace paths in mach-o binaries.
Replace old_dir with relative path from dirname of path name
in rpaths and deps; idpath is replaced with @rpath/libname.
"""
paths_to_paths = dict()
if idpath:
paths_to_paths[idpath] = os.path.join("@rpath", "%s" % os.path.basename(idpath))
for rpath in rpaths:
if re.match(old_layout_root, rpath):
rel = os.path.relpath(rpath, start=os.path.dirname(path_name))
paths_to_paths[rpath] = os.path.join("@loader_path", "%s" % rel)
else:
paths_to_paths[rpath] = rpath
for dep in deps:
if re.match(old_layout_root, dep):
rel = os.path.relpath(dep, start=os.path.dirname(path_name))
paths_to_paths[dep] = os.path.join("@loader_path", "%s" % rel)
else:
paths_to_paths[dep] = dep
return paths_to_paths
def macho_make_paths_normal(orig_path_name, rpaths, deps, idpath):
"""
Return a dictionary mapping the relativized rpaths to the original rpaths.
This dictionary is used to replace paths in mach-o binaries.
Replace '@loader_path' with the dirname of the origname path name
in rpaths and deps; idpath is replaced with the original path name
"""
rel_to_orig = dict()
if idpath:
rel_to_orig[idpath] = orig_path_name
for rpath in rpaths:
if re.match("@loader_path", rpath):
norm = os.path.normpath(
re.sub(re.escape("@loader_path"), os.path.dirname(orig_path_name), rpath)
)
rel_to_orig[rpath] = norm
else:
rel_to_orig[rpath] = rpath
for dep in deps:
if re.match("@loader_path", dep):
norm = os.path.normpath(
re.sub(re.escape("@loader_path"), os.path.dirname(orig_path_name), dep)
)
rel_to_orig[dep] = norm
else:
rel_to_orig[dep] = dep
return rel_to_orig
def macho_find_paths(orig_rpaths, deps, idpath, old_layout_root, prefix_to_prefix):
"""
Inputs
original rpaths from mach-o binaries
@@ -74,12 +207,13 @@ def macho_find_paths(orig_rpaths, deps, idpath, prefix_to_prefix):
# Sort from longest path to shortest, to ensure we try /foo/bar/baz before /foo/bar
prefix_iteration_order = sorted(prefix_to_prefix, key=len, reverse=True)
for orig_rpath in orig_rpaths:
for old_prefix in prefix_iteration_order:
new_prefix = prefix_to_prefix[old_prefix]
if orig_rpath.startswith(old_prefix):
new_rpath = re.sub(re.escape(old_prefix), new_prefix, orig_rpath)
paths_to_paths[orig_rpath] = new_rpath
break
if orig_rpath.startswith(old_layout_root):
for old_prefix in prefix_iteration_order:
new_prefix = prefix_to_prefix[old_prefix]
if orig_rpath.startswith(old_prefix):
new_rpath = re.sub(re.escape(old_prefix), new_prefix, orig_rpath)
paths_to_paths[orig_rpath] = new_rpath
break
else:
paths_to_paths[orig_rpath] = orig_rpath
@@ -214,7 +348,9 @@ def _set_elf_rpaths_and_interpreter(
return None
def relocate_macho_binaries(path_names, prefix_to_prefix):
def relocate_macho_binaries(
path_names, old_layout_root, new_layout_root, prefix_to_prefix, rel, old_prefix, new_prefix
):
"""
Use macholib python package to get the rpaths, depedent libraries
and library identity for libraries from the MachO object. Modify them
@@ -227,15 +363,77 @@ def relocate_macho_binaries(path_names, prefix_to_prefix):
# Corner case where macho object file ended up in the path name list
if path_name.endswith(".o"):
continue
# get the paths in the old prefix
rpaths, deps, idpath = macholib_get_paths(path_name)
# get the mapping of paths in the old prerix to the new prefix
paths_to_paths = macho_find_paths(rpaths, deps, idpath, prefix_to_prefix)
# replace the old paths with new paths
modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths)
if rel:
# get the relativized paths
rpaths, deps, idpath = macholib_get_paths(path_name)
# get the file path name in the original prefix
orig_path_name = re.sub(re.escape(new_prefix), old_prefix, path_name)
# get the mapping of the relativized paths to the original
# normalized paths
rel_to_orig = macho_make_paths_normal(orig_path_name, rpaths, deps, idpath)
# replace the relativized paths with normalized paths
modify_macho_object(path_name, rpaths, deps, idpath, rel_to_orig)
# get the normalized paths in the mach-o binary
rpaths, deps, idpath = macholib_get_paths(path_name)
# get the mapping of paths in old prefix to path in new prefix
paths_to_paths = macho_find_paths(
rpaths, deps, idpath, old_layout_root, prefix_to_prefix
)
# replace the old paths with new paths
modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths)
# get the new normalized path in the mach-o binary
rpaths, deps, idpath = macholib_get_paths(path_name)
# get the mapping of paths to relative paths in the new prefix
paths_to_paths = macho_make_paths_relative(
path_name, new_layout_root, rpaths, deps, idpath
)
# replace the new paths with relativized paths in the new prefix
modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths)
else:
# get the paths in the old prefix
rpaths, deps, idpath = macholib_get_paths(path_name)
# get the mapping of paths in the old prerix to the new prefix
paths_to_paths = macho_find_paths(
rpaths, deps, idpath, old_layout_root, prefix_to_prefix
)
# replace the old paths with new paths
modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths)
def relocate_elf_binaries(binaries, prefix_to_prefix):
def _transform_rpaths(orig_rpaths, orig_root, new_prefixes):
"""Return an updated list of RPATHs where each entry in the original list
starting with the old root is relocated to another place according to the
mapping passed as argument.
Args:
orig_rpaths (list): list of the original RPATHs
orig_root (str): original root to be substituted
new_prefixes (dict): dictionary that maps the original prefixes to
where they should be relocated
Returns:
List of paths
"""
new_rpaths = []
for orig_rpath in orig_rpaths:
# If the original RPATH doesn't start with the target root
# append it verbatim and proceed
if not orig_rpath.startswith(orig_root):
new_rpaths.append(orig_rpath)
continue
# Otherwise inspect the mapping and transform + append any prefix
# that starts with a registered key
# avoiding duplicates
for old_prefix, new_prefix in new_prefixes.items():
if orig_rpath.startswith(old_prefix):
new_rpath = re.sub(re.escape(old_prefix), new_prefix, orig_rpath)
if new_rpath not in new_rpaths:
new_rpaths.append(new_rpath)
return new_rpaths
def new_relocate_elf_binaries(binaries, prefix_to_prefix):
"""Take a list of binaries, and an ordered dictionary of
prefix to prefix mapping, and update the rpaths accordingly."""
@@ -254,6 +452,98 @@ def relocate_elf_binaries(binaries, prefix_to_prefix):
_set_elf_rpaths_and_interpreter(path, rpaths=rpaths, interpreter=interpreter)
def relocate_elf_binaries(
binaries, orig_root, new_root, new_prefixes, rel, orig_prefix, new_prefix
):
"""Relocate the binaries passed as arguments by changing their RPATHs.
Use patchelf to get the original RPATHs and then replace them with
rpaths in the new directory layout.
New RPATHs are determined from a dictionary mapping the prefixes in the
old directory layout to the prefixes in the new directory layout if the
rpath was in the old layout root, i.e. system paths are not replaced.
Args:
binaries (list): list of binaries that might need relocation, located
in the new prefix
orig_root (str): original root to be substituted
new_root (str): new root to be used, only relevant for relative RPATHs
new_prefixes (dict): dictionary that maps the original prefixes to
where they should be relocated
rel (bool): True if the RPATHs are relative, False if they are absolute
orig_prefix (str): prefix where the executable was originally located
new_prefix (str): prefix where we want to relocate the executable
"""
for new_binary in binaries:
orig_rpaths = _elf_rpaths_for(new_binary)
# TODO: Can we deduce `rel` from the original RPATHs?
if rel:
# Get the file path in the original prefix
orig_binary = re.sub(re.escape(new_prefix), orig_prefix, new_binary)
# Get the normalized RPATHs in the old prefix using the file path
# in the orig prefix
orig_norm_rpaths = _normalize_relative_paths(orig_binary, orig_rpaths)
# Get the normalize RPATHs in the new prefix
new_norm_rpaths = _transform_rpaths(orig_norm_rpaths, orig_root, new_prefixes)
# Get the relative RPATHs in the new prefix
new_rpaths = _make_relative(new_binary, new_root, new_norm_rpaths)
# check to see if relative rpaths are changed before rewriting
if sorted(new_rpaths) != sorted(orig_rpaths):
_set_elf_rpaths_and_interpreter(new_binary, new_rpaths)
else:
new_rpaths = _transform_rpaths(orig_rpaths, orig_root, new_prefixes)
_set_elf_rpaths_and_interpreter(new_binary, new_rpaths)
def make_link_relative(new_links, orig_links):
"""Compute the relative target from the original link and
make the new link relative.
Args:
new_links (list): new links to be made relative
orig_links (list): original links
"""
for new_link, orig_link in zip(new_links, orig_links):
target = readlink(orig_link)
relative_target = os.path.relpath(target, os.path.dirname(orig_link))
os.unlink(new_link)
symlink(relative_target, new_link)
def make_macho_binaries_relative(cur_path_names, orig_path_names, old_layout_root):
"""
Replace old RPATHs with paths relative to old_dir in binary files
"""
if not sys.platform == "darwin":
return
for cur_path, orig_path in zip(cur_path_names, orig_path_names):
(rpaths, deps, idpath) = macholib_get_paths(cur_path)
paths_to_paths = macho_make_paths_relative(
orig_path, old_layout_root, rpaths, deps, idpath
)
modify_macho_object(cur_path, rpaths, deps, idpath, paths_to_paths)
def make_elf_binaries_relative(new_binaries, orig_binaries, orig_layout_root):
"""Replace the original RPATHs in the new binaries making them
relative to the original layout root.
Args:
new_binaries (list): new binaries whose RPATHs is to be made relative
orig_binaries (list): original binaries
orig_layout_root (str): path to be used as a base for making
RPATHs relative
"""
for new_binary, orig_binary in zip(new_binaries, orig_binaries):
orig_rpaths = _elf_rpaths_for(new_binary)
if orig_rpaths:
new_rpaths = _make_relative(orig_binary, orig_layout_root, orig_rpaths)
_set_elf_rpaths_and_interpreter(new_binary, new_rpaths)
def warn_if_link_cant_be_relocated(link, target):
if not os.path.isabs(target):
return

View File

@@ -48,7 +48,7 @@ def rewire_node(spec, explicit):
# spec
prefix_to_prefix = {spec.build_spec.prefix: spec.prefix}
build_spec_ids = set(id(s) for s in spec.build_spec.traverse(deptype=dt.ALL & ~dt.BUILD))
for s in bindist.specs_to_relocate(spec):
for s in bindist.deps_to_relocate(spec):
analog = s
if id(s) not in build_spec_ids:
analogs = [
@@ -77,9 +77,25 @@ def rewire_node(spec, explicit):
]
if bins_to_relocate:
if "macho" in platform.binary_formats:
relocate.relocate_macho_binaries(bins_to_relocate, prefix_to_prefix)
relocate.relocate_macho_binaries(
bins_to_relocate,
str(spack.store.STORE.layout.root),
str(spack.store.STORE.layout.root),
prefix_to_prefix,
False,
spec.build_spec.prefix,
spec.prefix,
)
if "elf" in platform.binary_formats:
relocate.relocate_elf_binaries(bins_to_relocate, prefix_to_prefix)
relocate.relocate_elf_binaries(
bins_to_relocate,
str(spack.store.STORE.layout.root),
str(spack.store.STORE.layout.root),
prefix_to_prefix,
False,
spec.build_spec.prefix,
spec.prefix,
)
relocate.relocate_text_bin(binaries=bins_to_relocate, prefixes=prefix_to_prefix)
shutil.rmtree(tempdir)
install_manifest = os.path.join(

View File

@@ -4,7 +4,10 @@
"""This module contains jsonschema files for all of Spack's YAML formats."""
import copy
import typing
import warnings
import jsonschema
import jsonschema.exceptions
import jsonschema.validators
import llnl.util.lang
@@ -16,14 +19,14 @@ class DeprecationMessage(typing.NamedTuple):
error: bool
# jsonschema is imported lazily as it is heavy to import
# and increases the start-up time
class NonFatalValidationError(jsonschema.exceptions.ValidationError):
"""A validation error that should only produce a warning."""
def _make_validator():
import jsonschema
def _validate_spec(validator, is_spec, instance, schema):
"""Check if the attributes on instance are valid specs."""
import jsonschema
import spack.spec_parser
@@ -56,15 +59,18 @@ def _deprecated_properties(validator, deprecated, instance, schema):
# Process issues
errors = []
warnings = []
for name in issues:
msg = deprecations[name].message.format(name=name)
if deprecations[name].error:
errors.append(msg)
else:
warnings.warn(msg)
warnings.append(msg)
if errors:
yield jsonschema.ValidationError("\n".join(errors))
if warnings:
yield NonFatalValidationError("\n".join(warnings))
return jsonschema.validators.extend(
jsonschema.Draft4Validator,

View File

@@ -106,17 +106,10 @@
{
"names": ["install_missing_compilers"],
"message": "The config:install_missing_compilers option has been deprecated in "
"Spack v0.23, and is currently ignored. It will be removed from config in "
"Spack v0.23, and is currently ignored. It will be removed from config after "
"Spack v1.0.",
"error": False,
},
{
"names": ["install_path_scheme"],
"message": "The config:install_path_scheme option was deprecated in Spack v0.16 "
"in favor of config:install_tree:projections:all. It will be removed in Spack "
"v1.0.",
"error": False,
},
],
}
}

View File

@@ -9,6 +9,8 @@
"""
from typing import Any, Dict
import jsonschema
#: Common properties for connection specification
connection = {
"url": {"type": "string"},
@@ -102,7 +104,6 @@
def update(data):
import jsonschema
errors = []

View File

@@ -58,21 +58,7 @@
import re
import socket
import warnings
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Match,
Optional,
Set,
Tuple,
Union,
overload,
)
from typing_extensions import Literal
from typing import Any, Callable, Dict, Iterable, List, Match, Optional, Set, Tuple, Union
import archspec.cpu
@@ -97,7 +83,7 @@
import spack.solver
import spack.spec_parser
import spack.store
import spack.traverse
import spack.traverse as traverse
import spack.util.executable
import spack.util.hash
import spack.util.module_cmd as md
@@ -1353,16 +1339,16 @@ def tree(
depth: bool = False,
hashes: bool = False,
hashlen: Optional[int] = None,
cover: spack.traverse.CoverType = "nodes",
cover: str = "nodes",
indent: int = 0,
format: str = DEFAULT_FORMAT,
deptypes: Union[dt.DepFlag, dt.DepTypes] = dt.ALL,
deptypes: Union[Tuple[str, ...], str] = "all",
show_types: bool = False,
depth_first: bool = False,
recurse_dependencies: bool = True,
status_fn: Optional[Callable[["Spec"], InstallStatus]] = None,
prefix: Optional[Callable[["Spec"], str]] = None,
key: Callable[["Spec"], Any] = id,
key=id,
) -> str:
"""Prints out specs and their dependencies, tree-formatted with indentation.
@@ -1394,16 +1380,11 @@ def tree(
# reduce deptypes over all in-edges when covering nodes
if show_types and cover == "nodes":
deptype_lookup: Dict[str, dt.DepFlag] = collections.defaultdict(dt.DepFlag)
for edge in spack.traverse.traverse_edges(
specs, cover="edges", deptype=deptypes, root=False
):
for edge in traverse.traverse_edges(specs, cover="edges", deptype=deptypes, root=False):
deptype_lookup[edge.spec.dag_hash()] |= edge.depflag
# SupportsRichComparisonT issue with List[Spec]
sorted_specs: List["Spec"] = sorted(specs) # type: ignore[type-var]
for d, dep_spec in spack.traverse.traverse_tree(
sorted_specs, cover=cover, deptype=deptypes, depth_first=depth_first, key=key
for d, dep_spec in traverse.traverse_tree(
sorted(specs), cover=cover, deptype=deptypes, depth_first=depth_first, key=key
):
node = dep_spec.spec
@@ -1946,111 +1927,13 @@ def installed_upstream(self):
upstream, _ = spack.store.STORE.db.query_by_spec_hash(self.dag_hash())
return upstream
@overload
def traverse(
self,
*,
root: bool = ...,
order: spack.traverse.OrderType = ...,
cover: spack.traverse.CoverType = ...,
direction: spack.traverse.DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[False] = False,
key: Callable[["Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable["Spec"]: ...
@overload
def traverse(
self,
*,
root: bool = ...,
order: spack.traverse.OrderType = ...,
cover: spack.traverse.CoverType = ...,
direction: spack.traverse.DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[True],
key: Callable[["Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[Tuple[int, "Spec"]]: ...
def traverse(
self,
*,
root: bool = True,
order: spack.traverse.OrderType = "pre",
cover: spack.traverse.CoverType = "nodes",
direction: spack.traverse.DirectionType = "children",
deptype: Union[dt.DepFlag, dt.DepTypes] = "all",
depth: bool = False,
key: Callable[["Spec"], Any] = id,
visited: Optional[Set[Any]] = None,
) -> Iterable[Union["Spec", Tuple[int, "Spec"]]]:
def traverse(self, **kwargs):
"""Shorthand for :meth:`~spack.traverse.traverse_nodes`"""
return spack.traverse.traverse_nodes(
[self],
root=root,
order=order,
cover=cover,
direction=direction,
deptype=deptype,
depth=depth,
key=key,
visited=visited,
)
return traverse.traverse_nodes([self], **kwargs)
@overload
def traverse_edges(
self,
*,
root: bool = ...,
order: spack.traverse.OrderType = ...,
cover: spack.traverse.CoverType = ...,
direction: spack.traverse.DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[False] = False,
key: Callable[["Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[DependencySpec]: ...
@overload
def traverse_edges(
self,
*,
root: bool = ...,
order: spack.traverse.OrderType = ...,
cover: spack.traverse.CoverType = ...,
direction: spack.traverse.DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[True],
key: Callable[["Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[Tuple[int, DependencySpec]]: ...
def traverse_edges(
self,
*,
root: bool = True,
order: spack.traverse.OrderType = "pre",
cover: spack.traverse.CoverType = "nodes",
direction: spack.traverse.DirectionType = "children",
deptype: Union[dt.DepFlag, dt.DepTypes] = "all",
depth: bool = False,
key: Callable[["Spec"], Any] = id,
visited: Optional[Set[Any]] = None,
) -> Iterable[Union[DependencySpec, Tuple[int, DependencySpec]]]:
def traverse_edges(self, **kwargs):
"""Shorthand for :meth:`~spack.traverse.traverse_edges`"""
return spack.traverse.traverse_edges(
[self],
root=root,
order=order,
cover=cover,
direction=direction,
deptype=deptype,
depth=depth,
key=key,
visited=visited,
)
return traverse.traverse_edges([self], **kwargs)
@property
def short_spec(self):
@@ -3061,7 +2944,7 @@ def _finalize_concretization(self):
for spec in self.traverse():
spec._cached_hash(ht.dag_hash)
def concretized(self, tests: Union[bool, Iterable[str]] = False) -> "Spec":
def concretized(self, tests: Union[bool, Iterable[str]] = False) -> "spack.spec.Spec":
"""This is a non-destructive version of concretize().
First clones, then returns a concrete version of this package
@@ -4222,10 +4105,10 @@ def tree(
depth: bool = False,
hashes: bool = False,
hashlen: Optional[int] = None,
cover: spack.traverse.CoverType = "nodes",
cover: str = "nodes",
indent: int = 0,
format: str = DEFAULT_FORMAT,
deptypes: Union[dt.DepTypes, dt.DepFlag] = dt.ALL,
deptypes: Union[Tuple[str, ...], str] = "all",
show_types: bool = False,
depth_first: bool = False,
recurse_dependencies: bool = True,

View File

@@ -43,6 +43,7 @@
import spack.util.url as url_util
import spack.util.web as web_util
from spack.binary_distribution import CannotListKeys, GenerateIndexError
from spack.directory_layout import DirectoryLayout
from spack.paths import test_path
from spack.spec import Spec
@@ -135,28 +136,35 @@ def default_config(tmp_path, config_directory, monkeypatch, install_mockery):
@pytest.fixture(scope="function")
def install_dir_default_layout(tmpdir):
"""Hooks a fake install directory with a default layout"""
scheme = os.path.join(
"${architecture}", "${compiler.name}-${compiler.version}", "${name}-${version}-${hash}"
)
real_store, real_layout = spack.store.STORE, spack.store.STORE.layout
opt_dir = tmpdir.join("opt")
original_store, spack.store.STORE = spack.store.STORE, spack.store.Store(str(opt_dir))
spack.store.STORE = spack.store.Store(str(opt_dir))
spack.store.STORE.layout = DirectoryLayout(str(opt_dir), path_scheme=scheme)
try:
yield spack.store
finally:
spack.store.STORE = original_store
spack.store.STORE = real_store
spack.store.STORE.layout = real_layout
@pytest.fixture(scope="function")
def install_dir_non_default_layout(tmpdir):
"""Hooks a fake install directory with a non-default layout"""
opt_dir = tmpdir.join("opt")
original_store, spack.store.STORE = spack.store.STORE, spack.store.Store(
str(opt_dir),
projections={
"all": "{name}/{version}/{architecture}-{compiler.name}-{compiler.version}-{hash}"
},
scheme = os.path.join(
"${name}", "${version}", "${architecture}-${compiler.name}-${compiler.version}-${hash}"
)
real_store, real_layout = spack.store.STORE, spack.store.STORE.layout
opt_dir = tmpdir.join("opt")
spack.store.STORE = spack.store.Store(str(opt_dir))
spack.store.STORE.layout = DirectoryLayout(str(opt_dir), path_scheme=scheme)
try:
yield spack.store
finally:
spack.store.STORE = original_store
spack.store.STORE = real_store
spack.store.STORE.layout = real_layout
@pytest.fixture(scope="function")

View File

@@ -285,16 +285,3 @@ def compilers(compiler, arch_spec):
error = capfd.readouterr()[1]
assert "Skipping tests for package" in error
assert "test requires missing compiler" in error
def test_package_subscript(default_mock_concretization):
"""Tests that we can use the subscript notation on packages, and that it returns a package"""
root = default_mock_concretization("mpileaks")
root_pkg = root.package
# Subscript of a virtual
assert isinstance(root_pkg["mpi"], spack.package_base.PackageBase)
# Subscript on concrete
for d in root.traverse():
assert isinstance(root_pkg[d.name], spack.package_base.PackageBase)

View File

@@ -31,7 +31,13 @@
from spack.fetch_strategy import URLFetchStrategy
from spack.installer import PackageInstaller
from spack.paths import mock_gpg_keys_path
from spack.relocate import macho_find_paths, relocate_links, relocate_text
from spack.relocate import (
macho_find_paths,
macho_make_paths_normal,
macho_make_paths_relative,
relocate_links,
relocate_text,
)
from spack.spec import Spec
pytestmark = pytest.mark.not_on_windows("does not run on windows")
@@ -295,6 +301,7 @@ def test_replace_paths(tmpdir):
os.path.join(oldlibdir_local, libfile_loco),
],
os.path.join(oldlibdir_cc, libfile_c),
old_spack_dir,
prefix2prefix,
)
assert out_dict == {
@@ -318,6 +325,7 @@ def test_replace_paths(tmpdir):
os.path.join(oldlibdir_local, libfile_loco),
],
None,
old_spack_dir,
prefix2prefix,
)
assert out_dict == {
@@ -341,6 +349,7 @@ def test_replace_paths(tmpdir):
f"@rpath/{libfile_loco}",
],
None,
old_spack_dir,
prefix2prefix,
)
@@ -360,6 +369,7 @@ def test_replace_paths(tmpdir):
[oldlibdir_a, oldlibdir_b, oldlibdir_d, oldlibdir_local],
[f"@rpath/{libfile_a}", f"@rpath/{libfile_b}", f"@rpath/{libfile_loco}"],
None,
old_spack_dir,
prefix2prefix,
)
assert out_dict == {
@@ -373,6 +383,91 @@ def test_replace_paths(tmpdir):
}
def test_macho_make_paths():
out = macho_make_paths_relative(
"/Users/Shared/spack/pkgC/lib/libC.dylib",
"/Users/Shared/spack",
("/Users/Shared/spack/pkgA/lib", "/Users/Shared/spack/pkgB/lib", "/usr/local/lib"),
(
"/Users/Shared/spack/pkgA/libA.dylib",
"/Users/Shared/spack/pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib",
),
"/Users/Shared/spack/pkgC/lib/libC.dylib",
)
assert out == {
"/Users/Shared/spack/pkgA/lib": "@loader_path/../../pkgA/lib",
"/Users/Shared/spack/pkgB/lib": "@loader_path/../../pkgB/lib",
"/usr/local/lib": "/usr/local/lib",
"/Users/Shared/spack/pkgA/libA.dylib": "@loader_path/../../pkgA/libA.dylib",
"/Users/Shared/spack/pkgB/libB.dylib": "@loader_path/../../pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib": "/usr/local/lib/libloco.dylib",
"/Users/Shared/spack/pkgC/lib/libC.dylib": "@rpath/libC.dylib",
}
out = macho_make_paths_normal(
"/Users/Shared/spack/pkgC/lib/libC.dylib",
("@loader_path/../../pkgA/lib", "@loader_path/../../pkgB/lib", "/usr/local/lib"),
(
"@loader_path/../../pkgA/libA.dylib",
"@loader_path/../../pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib",
),
"@rpath/libC.dylib",
)
assert out == {
"@rpath/libC.dylib": "/Users/Shared/spack/pkgC/lib/libC.dylib",
"@loader_path/../../pkgA/lib": "/Users/Shared/spack/pkgA/lib",
"@loader_path/../../pkgB/lib": "/Users/Shared/spack/pkgB/lib",
"/usr/local/lib": "/usr/local/lib",
"@loader_path/../../pkgA/libA.dylib": "/Users/Shared/spack/pkgA/libA.dylib",
"@loader_path/../../pkgB/libB.dylib": "/Users/Shared/spack/pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib": "/usr/local/lib/libloco.dylib",
}
out = macho_make_paths_relative(
"/Users/Shared/spack/pkgC/bin/exeC",
"/Users/Shared/spack",
("/Users/Shared/spack/pkgA/lib", "/Users/Shared/spack/pkgB/lib", "/usr/local/lib"),
(
"/Users/Shared/spack/pkgA/libA.dylib",
"/Users/Shared/spack/pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib",
),
None,
)
assert out == {
"/Users/Shared/spack/pkgA/lib": "@loader_path/../../pkgA/lib",
"/Users/Shared/spack/pkgB/lib": "@loader_path/../../pkgB/lib",
"/usr/local/lib": "/usr/local/lib",
"/Users/Shared/spack/pkgA/libA.dylib": "@loader_path/../../pkgA/libA.dylib",
"/Users/Shared/spack/pkgB/libB.dylib": "@loader_path/../../pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib": "/usr/local/lib/libloco.dylib",
}
out = macho_make_paths_normal(
"/Users/Shared/spack/pkgC/bin/exeC",
("@loader_path/../../pkgA/lib", "@loader_path/../../pkgB/lib", "/usr/local/lib"),
(
"@loader_path/../../pkgA/libA.dylib",
"@loader_path/../../pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib",
),
None,
)
assert out == {
"@loader_path/../../pkgA/lib": "/Users/Shared/spack/pkgA/lib",
"@loader_path/../../pkgB/lib": "/Users/Shared/spack/pkgB/lib",
"/usr/local/lib": "/usr/local/lib",
"@loader_path/../../pkgA/libA.dylib": "/Users/Shared/spack/pkgA/libA.dylib",
"@loader_path/../../pkgB/libB.dylib": "/Users/Shared/spack/pkgB/libB.dylib",
"/usr/local/lib/libloco.dylib": "/usr/local/lib/libloco.dylib",
}
@pytest.fixture()
def mock_download(monkeypatch):
"""Mock a failing download strategy."""
@@ -466,6 +561,10 @@ def test_macho_relocation_with_changing_projection(relocation_dict):
"""
original_rpath = "/foo/bar/baz/abcdef"
result = macho_find_paths(
[original_rpath], deps=[], idpath=None, prefix_to_prefix=relocation_dict
[original_rpath],
deps=[],
idpath=None,
old_layout_root="/foo",
prefix_to_prefix=relocation_dict,
)
assert result[original_rpath] == "/a/b/c/abcdef"

View File

@@ -1,6 +1,8 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import os.path
import re
import shutil
@@ -112,6 +114,49 @@ def _copy_somewhere(orig_binary):
return _copy_somewhere
@pytest.mark.parametrize(
"start_path,path_root,paths,expected",
[
(
"/usr/bin/test",
"/usr",
["/usr/lib", "/usr/lib64", "/opt/local/lib"],
[
os.path.join("$ORIGIN", "..", "lib"),
os.path.join("$ORIGIN", "..", "lib64"),
"/opt/local/lib",
],
)
],
)
def test_make_relative_paths(start_path, path_root, paths, expected):
relatives = spack.relocate._make_relative(start_path, path_root, paths)
assert relatives == expected
@pytest.mark.parametrize(
"start_path,relative_paths,expected",
[
# $ORIGIN will be replaced with os.path.dirname('usr/bin/test')
# and then normalized
(
"/usr/bin/test",
["$ORIGIN/../lib", "$ORIGIN/../lib64", "/opt/local/lib"],
[
os.sep + os.path.join("usr", "lib"),
os.sep + os.path.join("usr", "lib64"),
"/opt/local/lib",
],
),
# Relative path without $ORIGIN
("/usr/bin/test", ["../local/lib"], ["../local/lib"]),
],
)
def test_normalize_relative_paths(start_path, relative_paths, expected):
normalized = spack.relocate._normalize_relative_paths(start_path, relative_paths)
assert normalized == expected
@pytest.mark.requires_executables("patchelf", "gcc")
@skip_unless_linux
def test_relocate_text_bin(binary_with_rpaths, prefix_like):
@@ -137,13 +182,61 @@ def test_relocate_elf_binaries_absolute_paths(binary_with_rpaths, copy_binary, p
new_binary = copy_binary(orig_binary)
spack.relocate.relocate_elf_binaries(
binaries=[str(new_binary)], prefix_to_prefix={str(orig_binary.dirpath()): "/foo"}
binaries=[str(new_binary)],
orig_root=str(orig_binary.dirpath()),
new_root=None, # Not needed when relocating absolute paths
new_prefixes={str(orig_binary.dirpath()): "/foo"},
rel=False,
# Not needed when relocating absolute paths
orig_prefix=None,
new_prefix=None,
)
# Some compilers add rpaths so ensure changes included in final result
assert "/foo/lib:/usr/lib64" in rpaths_for(new_binary)
@pytest.mark.requires_executables("patchelf", "gcc")
@skip_unless_linux
def test_relocate_elf_binaries_relative_paths(binary_with_rpaths, copy_binary):
# Create an executable, set some RPATHs, copy it to another location
orig_binary = binary_with_rpaths(rpaths=["lib", "lib64", "/opt/local/lib"])
new_binary = copy_binary(orig_binary)
spack.relocate.relocate_elf_binaries(
binaries=[str(new_binary)],
orig_root=str(orig_binary.dirpath()),
new_root=str(new_binary.dirpath()),
new_prefixes={str(orig_binary.dirpath()): "/foo"},
rel=True,
orig_prefix=str(orig_binary.dirpath()),
new_prefix=str(new_binary.dirpath()),
)
# Some compilers add rpaths so ensure changes included in final result
assert "/foo/lib:/foo/lib64:/opt/local/lib" in rpaths_for(new_binary)
@pytest.mark.requires_executables("patchelf", "gcc")
@skip_unless_linux
def test_make_elf_binaries_relative(binary_with_rpaths, copy_binary, prefix_tmpdir):
orig_binary = binary_with_rpaths(
rpaths=[
str(prefix_tmpdir.mkdir("lib")),
str(prefix_tmpdir.mkdir("lib64")),
"/opt/local/lib",
]
)
new_binary = copy_binary(orig_binary)
spack.relocate.make_elf_binaries_relative(
[str(new_binary)], [str(orig_binary)], str(orig_binary.dirpath())
)
# Some compilers add rpaths so ensure changes included in final result
assert "$ORIGIN/lib:$ORIGIN/lib64:/opt/local/lib" in rpaths_for(new_binary)
@pytest.mark.requires_executables("patchelf", "gcc")
@skip_unless_linux
def test_relocate_text_bin_with_message(binary_with_rpaths, copy_binary, prefix_tmpdir):

View File

@@ -105,25 +105,22 @@ def test_schema_validation(meta_schema, config_name):
def test_deprecated_properties(module_suffixes_schema):
# Test that an error is reported when 'error: True'
msg_fmt = r"{name} is deprecated"
module_suffixes_schema["deprecatedProperties"] = [
{"names": ["tcl"], "message": msg_fmt, "error": True}
{"names": ["tcl"], "message": r"{name} is deprecated", "error": True}
]
v = spack.schema.Validator(module_suffixes_schema)
data = {"tcl": {"all": {"suffixes": {"^python": "py"}}}}
expected_match = "tcl is deprecated"
with pytest.raises(jsonschema.ValidationError, match=expected_match):
v.validate(data)
with pytest.raises(jsonschema.ValidationError, match="tcl is deprecated") as e:
assert not isinstance(e, spack.schema.NonFatalValidationError)
spack.schema.Validator(module_suffixes_schema).validate(data)
# Test that just a warning is reported when 'error: False'
# Test that just a non fatal error is reported when 'error: False'
module_suffixes_schema["deprecatedProperties"] = [
{"names": ["tcl"], "message": msg_fmt, "error": False}
{"names": ["tcl"], "message": r"{name} is deprecated", "error": False}
]
v = spack.schema.Validator(module_suffixes_schema)
data = {"tcl": {"all": {"suffixes": {"^python": "py"}}}}
# The next validation doesn't raise anymore
v.validate(data)
with pytest.raises(spack.schema.NonFatalValidationError, match="tcl is deprecated"):
spack.schema.Validator(module_suffixes_schema).validate(data)
def test_ordereddict_merge_order():

View File

@@ -3,21 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from collections import defaultdict
from typing import (
Any,
Callable,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Set,
Tuple,
Union,
overload,
)
from typing_extensions import Literal
from typing import Any, Callable, List, NamedTuple, Set, Union
import spack.deptypes as dt
import spack.spec
@@ -438,95 +424,49 @@ def traverse_topo_edges_generator(edges, visitor, key=id, root=True, all_edges=F
# High-level API: traverse_edges, traverse_nodes, traverse_tree.
OrderType = Literal["pre", "post", "breadth", "topo"]
CoverType = Literal["nodes", "edges", "paths"]
DirectionType = Literal["children", "parents"]
@overload
def traverse_edges(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = ...,
order: OrderType = ...,
cover: CoverType = ...,
direction: DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[False] = False,
key: Callable[["spack.spec.Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable["spack.spec.DependencySpec"]: ...
@overload
def traverse_edges(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = ...,
order: OrderType = ...,
cover: CoverType = ...,
direction: DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[True],
key: Callable[["spack.spec.Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[Tuple[int, "spack.spec.DependencySpec"]]: ...
@overload
def traverse_edges(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = ...,
order: OrderType = ...,
cover: CoverType = ...,
direction: DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: bool,
key: Callable[["spack.spec.Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[Union["spack.spec.DependencySpec", Tuple[int, "spack.spec.DependencySpec"]]]: ...
def traverse_edges(
specs: Sequence["spack.spec.Spec"],
root: bool = True,
order: OrderType = "pre",
cover: CoverType = "nodes",
direction: DirectionType = "children",
specs,
root=True,
order="pre",
cover="nodes",
direction="children",
deptype: Union[dt.DepFlag, dt.DepTypes] = "all",
depth: bool = False,
key: Callable[["spack.spec.Spec"], Any] = id,
visited: Optional[Set[Any]] = None,
) -> Iterable[Union["spack.spec.DependencySpec", Tuple[int, "spack.spec.DependencySpec"]]]:
depth=False,
key=id,
visited=None,
):
"""
Iterable of edges from the DAG, starting from a list of root specs.
Generator that yields edges from the DAG, starting from a list of root specs.
Arguments:
specs: List of root specs (considered to be depth 0)
root: Yield the root nodes themselves
order: What order of traversal to use in the DAG. For depth-first search this can be
``pre`` or ``post``. For BFS this should be ``breadth``. For topological order use
``topo``
cover: Determines how extensively to cover the dag. Possible values:
specs (list): List of root specs (considered to be depth 0)
root (bool): Yield the root nodes themselves
order (str): What order of traversal to use in the DAG. For depth-first
search this can be ``pre`` or ``post``. For BFS this should be ``breadth``.
For topological order use ``topo``
cover (str): Determines how extensively to cover the dag. Possible values:
``nodes`` -- Visit each unique node in the dag only once.
``edges`` -- If a node has been visited once but is reached along a new path, it's
accepted, but not recurisvely followed. This traverses each 'edge' in the DAG once.
``paths`` -- Explore every unique path reachable from the root. This descends into
visited subtrees and will accept nodes multiple times if they're reachable by multiple
paths.
direction: ``children`` or ``parents``. If ``children``, does a traversal of this spec's
children. If ``parents``, traverses upwards in the DAG towards the root.
``edges`` -- If a node has been visited once but is reached along a
new path, it's accepted, but not recurisvely followed. This traverses
each 'edge' in the DAG once.
``paths`` -- Explore every unique path reachable from the root.
This descends into visited subtrees and will accept nodes multiple
times if they're reachable by multiple paths.
direction (str): ``children`` or ``parents``. If ``children``, does a traversal
of this spec's children. If ``parents``, traverses upwards in the DAG
towards the root.
deptype: allowed dependency types
depth: When ``False``, yield just edges. When ``True`` yield the tuple (depth, edge), where
depth corresponds to the depth at which edge.spec was discovered.
depth (bool): When ``False``, yield just edges. When ``True`` yield
the tuple (depth, edge), where depth corresponds to the depth
at which edge.spec was discovered.
key: function that takes a spec and outputs a key for uniqueness test.
visited: a set of nodes not to follow
visited (set or None): a set of nodes not to follow
Returns:
An iterable of ``DependencySpec`` if depth is ``False`` or a tuple of
``(depth, DependencySpec)`` if depth is ``True``.
A generator that yields ``DependencySpec`` if depth is ``False``
or a tuple of ``(depth, DependencySpec)`` if depth is ``True``.
"""
# validate input
if order == "topo":
@@ -544,7 +484,7 @@ def traverse_edges(
root_edges = with_artificial_edges(specs)
# Depth-first
if order == "pre" or order == "post":
if order in ("pre", "post"):
return traverse_depth_first_edges_generator(
root_edges, visitor, order == "post", root, depth
)
@@ -556,135 +496,79 @@ def traverse_edges(
)
@overload
def traverse_nodes(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = ...,
order: OrderType = ...,
cover: CoverType = ...,
direction: DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[False] = False,
key: Callable[["spack.spec.Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable["spack.spec.Spec"]: ...
@overload
def traverse_nodes(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = ...,
order: OrderType = ...,
cover: CoverType = ...,
direction: DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: Literal[True],
key: Callable[["spack.spec.Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[Tuple[int, "spack.spec.Spec"]]: ...
@overload
def traverse_nodes(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = ...,
order: OrderType = ...,
cover: CoverType = ...,
direction: DirectionType = ...,
deptype: Union[dt.DepFlag, dt.DepTypes] = ...,
depth: bool,
key: Callable[["spack.spec.Spec"], Any] = ...,
visited: Optional[Set[Any]] = ...,
) -> Iterable[Union["spack.spec.Spec", Tuple[int, "spack.spec.Spec"]]]: ...
def traverse_nodes(
specs: Sequence["spack.spec.Spec"],
*,
root: bool = True,
order: OrderType = "pre",
cover: CoverType = "nodes",
direction: DirectionType = "children",
specs,
root=True,
order="pre",
cover="nodes",
direction="children",
deptype: Union[dt.DepFlag, dt.DepTypes] = "all",
depth: bool = False,
key: Callable[["spack.spec.Spec"], Any] = id,
visited: Optional[Set[Any]] = None,
) -> Iterable[Union["spack.spec.Spec", Tuple[int, "spack.spec.Spec"]]]:
depth=False,
key=id,
visited=None,
):
"""
Iterable of specs from the DAG, starting from a list of root specs.
Generator that yields specs from the DAG, starting from a list of root specs.
Arguments:
specs: List of root specs (considered to be depth 0)
root: Yield the root nodes themselves
order: What order of traversal to use in the DAG. For depth-first search this can be
``pre`` or ``post``. For BFS this should be ``breadth``.
cover: Determines how extensively to cover the dag. Possible values:
specs (list): List of root specs (considered to be depth 0)
root (bool): Yield the root nodes themselves
order (str): What order of traversal to use in the DAG. For depth-first
search this can be ``pre`` or ``post``. For BFS this should be ``breadth``.
cover (str): Determines how extensively to cover the dag. Possible values:
``nodes`` -- Visit each unique node in the dag only once.
``edges`` -- If a node has been visited once but is reached along a new path, it's
accepted, but not recurisvely followed. This traverses each 'edge' in the DAG once.
``paths`` -- Explore every unique path reachable from the root. This descends into
visited subtrees and will accept nodes multiple times if they're reachable by multiple
paths.
direction: ``children`` or ``parents``. If ``children``, does a traversal of this spec's
children. If ``parents``, traverses upwards in the DAG towards the root.
``edges`` -- If a node has been visited once but is reached along a
new path, it's accepted, but not recurisvely followed. This traverses
each 'edge' in the DAG once.
``paths`` -- Explore every unique path reachable from the root.
This descends into visited subtrees and will accept nodes multiple
times if they're reachable by multiple paths.
direction (str): ``children`` or ``parents``. If ``children``, does a traversal
of this spec's children. If ``parents``, traverses upwards in the DAG
towards the root.
deptype: allowed dependency types
depth: When ``False``, yield just edges. When ``True`` yield the tuple ``(depth, edge)``,
where depth corresponds to the depth at which ``edge.spec`` was discovered.
depth (bool): When ``False``, yield just edges. When ``True`` yield
the tuple ``(depth, edge)``, where depth corresponds to the depth
at which ``edge.spec`` was discovered.
key: function that takes a spec and outputs a key for uniqueness test.
visited: a set of nodes not to follow
visited (set or None): a set of nodes not to follow
Yields:
By default :class:`~spack.spec.Spec`, or a tuple ``(depth, Spec)`` if depth is
set to ``True``.
"""
for item in traverse_edges(
specs,
root=root,
order=order,
cover=cover,
direction=direction,
deptype=deptype,
depth=depth,
key=key,
visited=visited,
):
yield (item[0], item[1].spec) if depth else item.spec # type: ignore
for item in traverse_edges(specs, root, order, cover, direction, deptype, depth, key, visited):
yield (item[0], item[1].spec) if depth else item.spec
def traverse_tree(
specs: Sequence["spack.spec.Spec"],
cover: CoverType = "nodes",
deptype: Union[dt.DepFlag, dt.DepTypes] = "all",
key: Callable[["spack.spec.Spec"], Any] = id,
depth_first: bool = True,
) -> Iterable[Tuple[int, "spack.spec.DependencySpec"]]:
specs, cover="nodes", deptype: Union[dt.DepFlag, dt.DepTypes] = "all", key=id, depth_first=True
):
"""
Generator that yields ``(depth, DependencySpec)`` tuples in the depth-first
pre-order, so that a tree can be printed from it.
Arguments:
specs: List of root specs (considered to be depth 0)
cover: Determines how extensively to cover the dag. Possible values:
specs (list): List of root specs (considered to be depth 0)
cover (str): Determines how extensively to cover the dag. Possible values:
``nodes`` -- Visit each unique node in the dag only once.
``edges`` -- If a node has been visited once but is reached along a
new path, it's accepted, but not recurisvely followed. This traverses each 'edge' in
the DAG once.
``paths`` -- Explore every unique path reachable from the root. This descends into
visited subtrees and will accept nodes multiple times if they're reachable by multiple
paths.
new path, it's accepted, but not recurisvely followed. This traverses
each 'edge' in the DAG once.
``paths`` -- Explore every unique path reachable from the root.
This descends into visited subtrees and will accept nodes multiple
times if they're reachable by multiple paths.
deptype: allowed dependency types
key: function that takes a spec and outputs a key for uniqueness test.
depth_first: Explore the tree in depth-first or breadth-first order. When setting
``depth_first=True`` and ``cover=nodes``, each spec only occurs once at the shallowest
level, which is useful when rendering the tree in a terminal.
depth_first (bool): Explore the tree in depth-first or breadth-first order.
When setting ``depth_first=True`` and ``cover=nodes``, each spec only
occurs once at the shallowest level, which is useful when rendering
the tree in a terminal.
Returns:
A generator that yields ``(depth, DependencySpec)`` tuples in such an order that a tree can
be printed.
A generator that yields ``(depth, DependencySpec)`` tuples in such an order
that a tree can be printed.
"""
# BFS only makes sense when going over edges and nodes, for paths the tree is
# identical to DFS, which is much more efficient then.

View File

@@ -7,12 +7,11 @@
import subprocess
import sys
from pathlib import Path, PurePath
from typing import Callable, Dict, Optional, Sequence, TextIO, Type, Union, overload
import llnl.util.tty as tty
import spack.error
from spack.util.environment import EnvironmentModifications
import spack.util.environment
__all__ = ["Executable", "which", "which_string", "ProcessError"]
@@ -20,29 +19,33 @@
class Executable:
"""Class representing a program that can be run on the command line."""
def __init__(self, name: str) -> None:
def __init__(self, name):
file_path = str(Path(name))
if sys.platform != "win32" and name.startswith("."):
# pathlib strips the ./ from relative paths so it must be added back
file_path = os.path.join(".", file_path)
self.exe = [file_path]
self.default_env: Dict[str, str] = {}
self.default_envmod = EnvironmentModifications()
self.returncode = 0
self.default_env = {}
self.default_envmod = spack.util.environment.EnvironmentModifications()
self.returncode = None
self.ignore_quotes = False
def add_default_arg(self, *args: str) -> None:
if not self.exe:
raise ProcessError("Cannot construct executable for '%s'" % name)
def add_default_arg(self, *args):
"""Add default argument(s) to the command."""
self.exe.extend(args)
def with_default_args(self, *args: str) -> "Executable":
def with_default_args(self, *args):
"""Same as add_default_arg, but returns a copy of the executable."""
new = self.copy()
new.add_default_arg(*args)
return new
def copy(self) -> "Executable":
def copy(self):
"""Return a copy of this Executable."""
new = Executable(self.exe[0])
new.exe[:] = self.exe
@@ -50,7 +53,7 @@ def copy(self) -> "Executable":
new.default_envmod.extend(self.default_envmod)
return new
def add_default_env(self, key: str, value: str) -> None:
def add_default_env(self, key, value):
"""Set an environment variable when the command is run.
Parameters:
@@ -59,109 +62,68 @@ def add_default_env(self, key: str, value: str) -> None:
"""
self.default_env[key] = value
def add_default_envmod(self, envmod: EnvironmentModifications) -> None:
def add_default_envmod(self, envmod):
"""Set an EnvironmentModifications to use when the command is run."""
self.default_envmod.extend(envmod)
@property
def command(self) -> str:
"""Returns the entire command-line string"""
def command(self):
"""The command-line string.
Returns:
str: The executable and default arguments
"""
return " ".join(self.exe)
@property
def name(self) -> str:
"""Returns the executable name"""
def name(self):
"""The executable name.
Returns:
str: The basename of the executable
"""
return PurePath(self.path).name
@property
def path(self) -> str:
"""Returns the executable path"""
def path(self):
"""The path to the executable.
Returns:
str: The path to the executable
"""
return str(PurePath(self.exe[0]))
@overload
def __call__(
self,
*args: str,
fail_on_error: bool = ...,
ignore_errors: Union[int, Sequence[int]] = ...,
ignore_quotes: Optional[bool] = ...,
timeout: Optional[int] = ...,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
input: Optional[TextIO] = ...,
output: Union[Optional[TextIO], str] = ...,
error: Union[Optional[TextIO], str] = ...,
_dump_env: Optional[Dict[str, str]] = ...,
) -> None: ...
@overload
def __call__(
self,
*args: str,
fail_on_error: bool = ...,
ignore_errors: Union[int, Sequence[int]] = ...,
ignore_quotes: Optional[bool] = ...,
timeout: Optional[int] = ...,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
input: Optional[TextIO] = ...,
output: Union[Type[str], Callable],
error: Union[Optional[TextIO], str, Type[str], Callable] = ...,
_dump_env: Optional[Dict[str, str]] = ...,
) -> str: ...
@overload
def __call__(
self,
*args: str,
fail_on_error: bool = ...,
ignore_errors: Union[int, Sequence[int]] = ...,
ignore_quotes: Optional[bool] = ...,
timeout: Optional[int] = ...,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
input: Optional[TextIO] = ...,
output: Union[Optional[TextIO], str, Type[str], Callable] = ...,
error: Union[Type[str], Callable],
_dump_env: Optional[Dict[str, str]] = ...,
) -> str: ...
def __call__(
self,
*args: str,
fail_on_error: bool = True,
ignore_errors: Union[int, Sequence[int]] = (),
ignore_quotes: Optional[bool] = None,
timeout: Optional[int] = None,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = None,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = None,
input: Optional[TextIO] = None,
output: Union[Optional[TextIO], str, Type[str], Callable] = None,
error: Union[Optional[TextIO], str, Type[str], Callable] = None,
_dump_env: Optional[Dict[str, str]] = None,
) -> Optional[str]:
"""Runs this executable in a subprocess.
def __call__(self, *args, **kwargs):
"""Run this executable in a subprocess.
Parameters:
*args: command-line arguments to the executable to run
fail_on_error: if True, raises an exception if the subprocess returns an error
The return code is available as ``self.returncode``
ignore_errors: a sequence of error codes to ignore. If these codes are returned, this
process will not raise an exception, even if ``fail_on_error`` is set to ``True``
ignore_quotes: if False, warn users that quotes are not needed, as Spack does not
use a shell. If None, use ``self.ignore_quotes``.
timeout: the number of seconds to wait before killing the child process
env: the environment with which to run the executable
extra_env: extra items to add to the environment (neither requires nor precludes env)
input: where to read stdin from
output: where to send stdout
error: where to send stderr
_dump_env: dict to be set to the environment actually used (envisaged for
testing purposes only)
*args (str): Command-line arguments to the executable to run
Keyword Arguments:
_dump_env (dict): Dict to be set to the environment actually
used (envisaged for testing purposes only)
env (dict or EnvironmentModifications): The environment with which
to run the executable
extra_env (dict or EnvironmentModifications): Extra items to add to
the environment (neither requires nor precludes env)
fail_on_error (bool): Raise an exception if the subprocess returns
an error. Default is True. The return code is available as
``exe.returncode``
ignore_errors (int or list): A list of error codes to ignore.
If these codes are returned, this process will not raise
an exception even if ``fail_on_error`` is set to ``True``
ignore_quotes (bool): If False, warn users that quotes are not needed
as Spack does not use a shell. Defaults to False.
timeout (int or float): The number of seconds to wait before killing
the child process
input: Where to read stdin from
output: Where to send stdout
error: Where to send stderr
Accepted values for input, output, and error:
* python streams, e.g. open Python file objects, or ``os.devnull``
* filenames, which will be automatically opened for writing
* ``str``, as in the Python string type. If you set these to ``str``,
output and error will be written to pipes and returned as a string.
If both ``output`` and ``error`` are set to ``str``, then one string
@@ -171,11 +133,8 @@ def __call__(
Behaves the same as ``str``, except that value is also written to
``stdout`` or ``stderr``.
For output and error it's also accepted:
* filenames, which will be automatically opened for writing
By default, the subprocess inherits the parent's file descriptors.
"""
def process_cmd_output(out, err):
@@ -200,34 +159,44 @@ def process_cmd_output(out, err):
sys.stderr.write(errstr)
return result
# Environment
env_arg = kwargs.get("env", None)
# Setup default environment
current_environment = os.environ.copy() if env is None else {}
self.default_envmod.apply_modifications(current_environment)
current_environment.update(self.default_env)
env = os.environ.copy() if env_arg is None else {}
self.default_envmod.apply_modifications(env)
env.update(self.default_env)
# Apply env argument
if isinstance(env, EnvironmentModifications):
env.apply_modifications(current_environment)
elif env:
current_environment.update(env)
if isinstance(env_arg, spack.util.environment.EnvironmentModifications):
env_arg.apply_modifications(env)
elif env_arg:
env.update(env_arg)
# Apply extra env
if isinstance(extra_env, EnvironmentModifications):
extra_env.apply_modifications(current_environment)
elif extra_env is not None:
current_environment.update(extra_env)
extra_env = kwargs.get("extra_env", {})
if isinstance(extra_env, spack.util.environment.EnvironmentModifications):
extra_env.apply_modifications(env)
else:
env.update(extra_env)
if _dump_env is not None:
_dump_env.clear()
_dump_env.update(current_environment)
if "_dump_env" in kwargs:
kwargs["_dump_env"].clear()
kwargs["_dump_env"].update(env)
if ignore_quotes is None:
ignore_quotes = self.ignore_quotes
fail_on_error = kwargs.pop("fail_on_error", True)
ignore_errors = kwargs.pop("ignore_errors", ())
ignore_quotes = kwargs.pop("ignore_quotes", self.ignore_quotes)
timeout = kwargs.pop("timeout", None)
# If they just want to ignore one error code, make it a tuple.
if isinstance(ignore_errors, int):
ignore_errors = (ignore_errors,)
input = kwargs.pop("input", None)
output = kwargs.pop("output", None)
error = kwargs.pop("error", None)
if input is str:
raise ValueError("Cannot use `str` as input stream.")
@@ -261,15 +230,9 @@ def streamify(arg, mode):
cmd_line_string = " ".join(escaped_cmd)
tty.debug(cmd_line_string)
result = None
try:
proc = subprocess.Popen(
cmd,
stdin=istream,
stderr=estream,
stdout=ostream,
env=current_environment,
close_fds=False,
cmd, stdin=istream, stderr=estream, stdout=ostream, env=env, close_fds=False
)
out, err = proc.communicate(timeout=timeout)
@@ -285,6 +248,9 @@ def streamify(arg, mode):
long_msg += "\n" + result
raise ProcessError("Command exited with status %d:" % proc.returncode, long_msg)
return result
except OSError as e:
message = "Command: " + cmd_line_string
if " " in self.exe[0]:
@@ -320,8 +286,6 @@ def streamify(arg, mode):
if close_istream:
istream.close()
return result
def __eq__(self, other):
return hasattr(other, "exe") and self.exe == other.exe

View File

@@ -13,7 +13,6 @@ spack:
- openjpeg # CMakePackage
- r-rcpp # RPackage
- ruby-rake # RubyPackage
- perl-data-dumper # PerlPackage
- arch:
- '%gcc'

View File

@@ -93,7 +93,7 @@ class AbseilCpp(CMakePackage):
depends_on("cmake@3.5:", when="@20190312:", type="build")
depends_on("cmake@3.1:", type="build")
depends_on("googletest~absl", type="test", when="@20220623:")
depends_on("googletest", type="build", when="@20220623:")
def cmake_args(self):
run_tests = self.run_tests and self.spec.satisfies("@20220623:")

View File

@@ -16,7 +16,6 @@ class ActsAlgebraPlugins(CMakePackage):
license("MPL-2.0", checked_by="stephenswat")
version("0.26.2", sha256="0170f22e1a75493b86464f27991117bc2c5a9d52554c75786e321d4c591990e7")
version("0.26.1", sha256="8eb1e9e28ec2839d149b6a6bddd0f983b0cdf71c286c0aeb67ede31727c5b7d3")
version("0.26.0", sha256="301702e3d0a3d12e46ae6d949f3027ddebd0b1167cbb3004d9a4a5697d3adc7f")
version("0.25.0", sha256="bb0cba6e37558689d780a6de8f749abb3b96f8cd9e0c8851474eb4532e1e98b8")

View File

@@ -40,7 +40,6 @@ class Acts(CMakePackage, CudaPackage):
# Supported Acts versions
version("main", branch="main")
version("master", branch="main", deprecated=True) # For compatibility
version("38.2.0", commit="9cb8f4494656553fd9b85955938b79b2fac4c9b0", submodules=True)
version("38.1.0", commit="8a20c88808f10bf4fcdfd7c6e077f23614c3ab90", submodules=True)
version("38.0.0", commit="0a6b5155e29e3b755bf351b8a76067fff9b4214b", submodules=True)
version("37.4.0", commit="4ae9a44f54c854599d1d753222ec36e0b5b4e9c7", submodules=True)

View File

@@ -25,7 +25,6 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage):
license("BSD-3-Clause")
version("develop", branch="development")
version("25.01", sha256="29eb35cf67d66b0fd0654282454c210abfadf27fcff8478b256e3196f237c74f")
version("24.12", sha256="ca4b41ac73fabb9cf3600b530c9823eb3625f337d9b7b9699c1089e81c67fc67")
version("24.11", sha256="31cc37b39f15e02252875815f6066046fc56a479bf459362b9889b0d6a202df6")
version("24.10", sha256="a2d15e417bd7c41963749338e884d939c80c5f2fcae3279fe3f1b463e3e4208a")
@@ -152,8 +151,6 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage):
# Build dependencies
depends_on("mpi", when="+mpi")
with when("+linear_solvers"):
depends_on("rocsparse", when="@25.01: +rocm")
with when("+fft"):
depends_on("rocfft", when="+rocm")
depends_on("fftw@3", when="~cuda ~rocm ~sycl")

View File

@@ -16,7 +16,6 @@ class Armadillo(CMakePackage):
license("Apache-2.0")
version("14.2.2", sha256="3054c8e63db3abdf1a5c8f9fdb7e6b4ad833f9bcfb58324c0ff86de0784c70e0")
version("14.0.3", sha256="ebd6215eeb01ee412fed078c8a9f7f87d4e1f6187ebcdc1bc09f46095a4f4003")
version("14.0.2", sha256="248e2535fc092add6cb7dea94fc86ae1c463bda39e46fd82d2a7165c1c197dff")
version("12.8.4", sha256="558fe526b990a1663678eff3af6ec93f79ee128c81a4c8aef27ad328fae61138")
@@ -34,14 +33,14 @@ class Armadillo(CMakePackage):
depends_on("c", type="build")
depends_on("cxx", type="build")
variant("hdf5", default=False, description="Include HDF5 support", when="@:10")
variant("hdf5", default=False, description="Include HDF5 support")
depends_on("cmake@2.8.12:", type="build")
depends_on("cmake@3.5:", type="build", when="@14:")
depends_on("arpack-ng") # old arpack causes undefined symbols
depends_on("blas")
depends_on("lapack")
depends_on("superlu@5.2:5") # only superlu@5 is supported
depends_on("superlu@5.2:")
depends_on("hdf5", when="+hdf5")
# Adds an `#undef linux` to prevent preprocessor expansion of include

View File

@@ -97,8 +97,7 @@ class Chai(CachedCMakePackage, CudaPackage, ROCmPackage):
)
version("1.0", tag="v1.0", commit="501a098ad879dc8deb4a74fcfe8c08c283a10627", submodules=True)
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("cxx", type="build") # generated
# Patching Umpire for dual BLT targets import changed MPI target name in Umpire link interface
# We propagate the patch here.

View File

@@ -790,7 +790,7 @@ def edit(self, pkg, spec, prefix):
"# include Plumed.inc as recommended by"
"PLUMED to include libraries and flags"
)
mkf.write("include {0}\n".format(self.pkg["plumed"].plumed_inc))
mkf.write("include {0}\n".format(spec["plumed"].package.plumed_inc))
mkf.write("\n# COMPILER, LINKER, TOOLS\n\n")
mkf.write(

View File

@@ -19,7 +19,6 @@ class Detray(CMakePackage):
license("MPL-2.0", checked_by="stephenswat")
version("0.87.0", sha256="2d4a76432dd6ddbfc00b88b5d482072e471fefc264b60748bb1f9a123963576e")
version("0.86.0", sha256="98350c94e8a2395b8712b7102fd449536857e8158b38a96cc913c79b70301170")
version("0.85.0", sha256="a0121a27fd08243d4a6aab060e8ab379ad5129e96775b45f6a683835767fa8e7")
version("0.84.0", sha256="b1d133a97dc90b1513f8c1ef235ceaa542d80243028a41f59a79300c7d71eb25")
@@ -78,7 +77,6 @@ class Detray(CMakePackage):
depends_on("acts-algebra-plugins +vc", when="+vc")
depends_on("acts-algebra-plugins +eigen", when="+eigen")
depends_on("acts-algebra-plugins +smatrix", when="+smatrix")
depends_on("acts-algebra-plugins@0.26.0:", when="@0.87:")
# Detray imposes requirements on the C++ standard values used by Algebra
# Plugins.

View File

@@ -9,7 +9,7 @@ class Dftd4(MesonPackage):
"""Generally Applicable Atomic-Charge Dependent London Dispersion Correction"""
homepage = "https://www.chemie.uni-bonn.de/pctc/mulliken-center/software/dftd4"
url = "https://github.com/dftd4/dftd4/releases/download/v0.0.0/dftd4-0.0.0.tar.xz"
url = "https://github.com/dftd4/dftd4/releases/download/v3.5.0/dftd4-3.5.0-source.tar.xz"
git = "https://github.com/dftd4/dftd4.git"
maintainers("awvwgk")
@@ -17,8 +17,6 @@ class Dftd4(MesonPackage):
license("LGPL-3.0-only")
version("main", branch="main")
version("3.7.0", sha256="4e8749df6852bf863d5d1831780a2d30e9ac4afcfebbbfe5f6a6a73d06d6c6ee")
version("3.6.0", sha256="56b3b4650853a34347d3d56c93d7596ecbe2208c4a14dbd027959fd4a009679d")
version("3.5.0", sha256="d2bab992b5ef999fd13fec8eb1da9e9e8d94b8727a2e624d176086197a00a46f")
version("3.4.0", sha256="24fcb225cdd5c292ac26f7d3204ee3c4024174adb5272eeda9ae7bc57113ec8d")
version("3.3.0", sha256="408720b8545532d5240dd743c05d57b140af983192dad6d965b0d79393d0a9ef")
@@ -56,8 +54,3 @@ def meson_args(self):
"-Dopenmp={0}".format(str("+openmp" in self.spec).lower()),
"-Dpython={0}".format(str("+python" in self.spec).lower()),
]
def url_for_version(self, version):
if version <= Version("3.6.0"):
return f"https://github.com/dftd4/dftd4/releases/download/v{version}/dftd4-{version}-source.tar.xz"
return super().url_for_version(version)

View File

@@ -20,17 +20,15 @@ class Ensmallen(CMakePackage):
license("BSD-3-Clause")
version("2.22.1", sha256="daf53fe96783043ca33151a3851d054a826fab8d9a173e6bcbbedd4a7eabf5b1")
version("2.21.1", sha256="820eee4d8aa32662ff6a7d883a1bcaf4e9bf9ca0a3171d94c5398fe745008750")
version("2.19.1", sha256="f36ad7f08b0688d2a8152e1c73dd437c56ed7a5af5facf65db6ffd977b275b2e")
depends_on("cxx", type="build")
depends_on("cxx", type="build") # generated
variant("openmp", default=True, description="Use OpenMP for parallelization")
depends_on("cmake@3.3.2:")
depends_on("armadillo@9.800.0:")
depends_on("armadillo@10.8.2:", when="@2.22:")
def cmake_args(self):
args = [self.define_from_variant("USE_OPENMP", "openmp")]

View File

@@ -20,7 +20,6 @@ class FluxCore(AutotoolsPackage):
license("LGPL-3.0-only")
version("master", branch="master")
version("0.67.0", sha256="9406e776cbeff971881143fd1b94c42ec912e5b226401d2d3d91d766dd81de8c")
version("0.66.0", sha256="0a25cfb1ebc033c249614eb2350c6fb57b00cdf3c584d0759c787f595c360daa")
version("0.65.0", sha256="a60bc7ed13b8e6d09e99176123a474aad2d9792fff6eb6fd4da2a00e1d2865ab")
version("0.64.0", sha256="0334d6191915f1b89b70cdbf14f24200f8899da31090df5f502020533b304bb3")
@@ -97,7 +96,6 @@ class FluxCore(AutotoolsPackage):
depends_on("py-pyyaml@3.10:", type=("build", "run"))
depends_on("py-jsonschema@2.3:", type=("build", "run"), when="@:0.58.0")
depends_on("py-ply", type=("build", "run"), when="@0.46.1:")
depends_on("py-setuptools", type="build", when="@0.67.0:")
depends_on("jansson@2.10:")
depends_on("pkgconfig")
depends_on("lz4")

View File

@@ -56,6 +56,8 @@ class Geant4Data(BundlePackage):
"g4incl@1.2",
"g4ensdfstate@3.0",
"g4channeling@1.0",
"g4nudexlib@1.0",
"g4urrpt@1.1",
],
"11.2.2:11.2": [
"g4ndl@4.7.1",
@@ -193,23 +195,6 @@ class Geant4Data(BundlePackage):
for _d in _dsets:
depends_on(_d, type=("build", "run"), when=_vers)
_datasets_tendl = {
"11.0:11.3": "g4tendl@1.4",
"10.4:10.7": "g4tendl@1.3.2",
"10.3:10.3": "g4tendl@1.3",
}
variant("tendl", default=True, when="@10.3:", description="Enable G4TENDL")
with when("+tendl"):
for _vers, _d in _datasets_tendl.items():
depends_on(_d, type=("build", "run"), when="@" + _vers)
variant("nudexlib", default=True, when="@11.3.0:11.3", description="Enable G4NUDEXLIB")
with when("+nudexlib"):
depends_on("g4nudexlib@1.0", type=("build", "run"))
variant("urrpt", default=True, when="@11.3.0:11.3", description="Enable G4URRPT")
with when("+urrpt"):
depends_on("g4urrpt@1.1", type=("build", "run"))
@property
def datadir(self):
spec = self.spec

View File

@@ -153,7 +153,7 @@ def common_args(self):
"CC={0}".format(env["CC"]),
"PREFIX={0}".format(self.spec.prefix.bin),
"MFEM_DIR={0}".format(self.spec["mfem"].prefix),
"CONFIG_MK={0}".format(self.pkg["mfem"].config_mk),
"CONFIG_MK={0}".format(self.spec["mfem"].package.config_mk),
]
# https://github.com/spack/spack/issues/42839

View File

@@ -17,13 +17,11 @@ class Gnutls(AutotoolsPackage):
homepage = "https://www.gnutls.org"
url = "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.19.tar.xz"
list_depth = 2
maintainers("alecbcs")
license("LGPL-2.1-or-later")
version("3.8.8", sha256="ac4f020e583880b51380ed226e59033244bc536cad2623f2e26f5afa2939d8fb")
version("3.8.4", sha256="2bea4e154794f3f00180fa2a5c51fe8b005ac7a31cd58bd44cdfa7f36ebc3a9b")
version("3.8.3", sha256="f74fc5954b27d4ec6dfbb11dea987888b5b124289a3703afcada0ee520f4173e")
version("3.7.8", sha256="c58ad39af0670efe6a8aee5e3a8b2331a1200418b64b7c51977fb396d4617114")

View File

@@ -15,8 +15,6 @@ class Googletest(CMakePackage):
maintainers("sethrj")
version("main", branch="main")
version("1.15.2", sha256="7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926")
version("1.15.0", sha256="7315acb6bf10e99f332c8a43f00d5fbb1ee6ca48c52f6b936991b216c586aaad")
version("1.14.0", sha256="8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7")
version("1.13.0", sha256="ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363")
version("1.12.1", sha256="81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2")
@@ -31,18 +29,14 @@ class Googletest(CMakePackage):
depends_on("c", type="build")
depends_on("cxx", type="build")
variant("absl", default=False, when="@1.12.1:", description="Build with abseil and RE2")
depends_on("abseil-cpp", when="+absl")
depends_on("re2", when="+absl")
variant("gmock", default=True, when="@1.8:", description="Build with gmock")
variant("pthreads", default=True, description="Build multithreaded version with pthreads")
variant("shared", default=True, description="Build shared libraries (DLLs)")
variant(
"cxxstd",
default="14",
values=("98", "11", "14", "17", "20"),
default="11",
values=("98", "11", "14", "17"),
multi=False,
description="Use the specified C++ standard when building",
)
@@ -54,13 +48,12 @@ def cmake_args(self):
args = [
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"),
self.define_from_variant("BUILD_GMOCK", "gmock"),
self.define_from_variant("GTEST_HAS_ABSL", "absl"),
self.define("gtest_disable_pthreads", spec.satisfies("~pthreads")),
]
if spec.satisfies("@:1.8.0"):
args.append(self.define("gtest_disable_pthreads", not spec.satisfies("+pthreads")))
if spec.satisfies("@1.8:"):
# New style (contains both Google Mock and Google Test)
args.append(self.define("BUILD_GTEST", True))
args.append(self.define_from_variant("BUILD_GMOCK", "gmock"))
return args

View File

@@ -585,7 +585,7 @@ def patch(self):
)
if self.spec.satisfies("+plumed"):
self["plumed"].apply_patch(self)
self.spec["plumed"].package.apply_patch(self)
if self.spec.satisfies("%nvhpc"):
# Disable obsolete workaround

View File

@@ -58,8 +58,8 @@ def build_targets(self):
spec = self.spec
targets.append("MFEM_DIR=%s" % spec["mfem"].prefix)
targets.append("CONFIG_MK=%s" % self["mfem"].config_mk)
targets.append("TEST_MK=%s" % self["mfem"].test_mk)
targets.append("CONFIG_MK=%s" % spec["mfem"].package.config_mk)
targets.append("TEST_MK=%s" % spec["mfem"].package.test_mk)
if spec.satisfies("@:2.0"):
targets.append("CXX=%s" % spec["mpi"].mpicxx)
if self.spec.satisfies("+ofast %gcc"):

View File

@@ -19,10 +19,6 @@ class Libmesh(AutotoolsPackage):
version("master", branch="master", submodules=True)
version("1.7.6", sha256="65093cc97227193241f78647ec2f04a1852437f40d3d1c49285c6ff712cd0bc8")
version("1.7.5", sha256="03a50cb471e7724a46623f0892cf77152f969d9ba89f8fcebd20bdc0845aab83")
version("1.7.4", sha256="0d603aacd2761292dff61ff7ce59d9fddd8691133f0219f7d1576bd4626b77b2")
version("1.7.3", sha256="fe0bec45a083ddd9e87dc51ab7e68039f3859e7ef0c4a87e76e562b172b6f739")
version("1.7.1", sha256="0387d62773cf92356eb128ba92f767e56c298d78f4b97446e68bf288da1eb6b4")
version("1.4.1", sha256="67eb7d5a9c954d891ca1386b70f138333a87a141d9c44213449ca6be69a66414")
version("1.4.0", sha256="62d7fce89096c950d1b38908484856ea63df57754b64cde6582e7ac407c8c81d")

View File

@@ -42,7 +42,7 @@ class Libspatialite(AutotoolsPackage):
depends_on("geos@:3.9", when="@:5.0.0")
depends_on("iconv")
depends_on("librttopo", when="@5.0.1:")
depends_on("libxml2+http")
depends_on("libxml2")
depends_on("minizip", when="@5.0.0:")
depends_on("proj")
depends_on("proj@:5", when="@:4")

View File

@@ -56,7 +56,6 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage):
license("Apache-2.0")
version("main", branch="main")
version("19.1.6", sha256="f07fdcbb27b2b67aa95e5ddadf45406b33228481c250e65175066d36536a1ee2")
version("19.1.5", sha256="e2204b9903cd9d7ee833a2f56a18bef40a33df4793e31cc090906b32cbd8a1f5")
version("19.1.4", sha256="010e1fd3cabee8799bd2f8a6fbc68f28207494f315cf9da7057a2820f79fd531")
version("19.1.3", sha256="e5106e2bef341b3f5e41340e4b6c6a58259f4021ad801acf14e88f1a84567b05")
@@ -1144,12 +1143,12 @@ def post_install(self):
with open(os.path.join(self.prefix.bin, cfg), "w") as f:
print(gcc_install_dir_flag, file=f)
def llvm_config(self, *args, result=None, **kwargs):
def llvm_config(self, *args, **kwargs):
lc = Executable(self.prefix.bin.join("llvm-config"))
if not kwargs.get("output"):
kwargs["output"] = str
ret = lc(*args, **kwargs)
if result == "list":
if kwargs.get("result") == "list":
return ret.split()
else:
return ret

View File

@@ -22,7 +22,6 @@ class Lmod(AutotoolsPackage):
license("MIT")
version("8.7.55", sha256="f85ed9b55c23afb563fa99c7201037628be016e8d88a1aa8dba4632c0ab450bd")
version("8.7.37", sha256="171529152fedfbb3c45d27937b0eaa1ee62b5e5cdac3086f44a6d56e5d1d7da4")
version("8.7.24", sha256="8451267652059b6507b652e1b563929ecf9b689ffb20830642085eb6a55bd539")
version("8.7.20", sha256="c04deff7d2ca354610a362459a7aa9a1c642a095e45a4b0bb2471bb3254e85f4")

View File

@@ -1309,7 +1309,7 @@ def libs(self):
@property
def config_mk(self):
"""Export the location of the config.mk file.
This property can be accessed using pkg["mfem"].config_mk
This property can be accessed using spec["mfem"].package.config_mk
"""
dirs = [self.prefix, self.prefix.share.mfem]
for d in dirs:
@@ -1321,7 +1321,7 @@ def config_mk(self):
@property
def test_mk(self):
"""Export the location of the test.mk file.
This property can be accessed using pkg["mfem"].test_mk.
This property can be accessed using spec["mfem"].package.test_mk.
In version 3.3.2 and newer, the location of test.mk is also defined
inside config.mk, variable MFEM_TEST_MK.
"""

View File

@@ -19,7 +19,6 @@ class Mlpack(CMakePackage):
license("BSD-3-Clause", checked_by="wdconinc")
version("4.5.1", sha256="58059b911a78b8bda91eef4cfc6278383b24e71865263c2e0569cf5faa59dda3")
version("4.5.0", sha256="aab70aee10c134ef3fe568843fe4b3bb5e8901af30ea666f57462ad950682317")
version("4.4.0", sha256="61c604026d05af26c244b0e47024698bbf150dfcc9d77b64057941d7d64d6cf6")
version("4.3.0", sha256="08cd54f711fde66fc3b6c9db89dc26776f9abf1a6256c77cfa3556e2a56f1a3d")
@@ -30,7 +29,8 @@ class Mlpack(CMakePackage):
depends_on("cxx", type="build") # generated
variant("go", default=False, description="Build Go bindings", when="@4.5.1:")
# TODO: Go bindings are not supported due to the absence of gonum in spack
# variant("go", default=False, description="Build Go bindings")
variant("julia", default=False, description="Build Julia bindings")
variant("python", default=False, description="Build Ppython bindings")
variant("r", default=False, description="Build R bindings")
@@ -47,9 +47,11 @@ class Mlpack(CMakePackage):
conflicts("%gcc@:4", when="@4.0:", msg="mlpack 4.0+ requires at least gcc-5 with C++14")
conflicts("%gcc@:7", when="@4.4:", msg="mlpack 4.4+ requires at least gcc-8 with C++17")
with when("+go"):
# ref: src/mlpack/bindings/go/CMakeLists.txt
depends_on("go@1.11.0:")
# TODO: Go bindings are not supported due to the absence of gonum in spack
# with when("+go"):
# # ref: src/mlpack/bindings/go/CMakeLists.txt
# depends_on("go@1.11.0:")
# depends_on("gonum")
with when("+julia"):
# ref: src/mlpack/bindings/julia/CMakeLists.txt
depends_on("julia@0.7.0:")
@@ -83,7 +85,7 @@ class Mlpack(CMakePackage):
def cmake_args(self):
args = [
self.define("BUILD_CLI_EXECUTABLES", True),
self.define_from_variant("BUILD_GO_BINDINGS", "go"),
# self.define_from_variant("BUILD_GO_BINDINGS", "go"),
self.define_from_variant("BUILD_JULIA_BINDINGS", "julia"),
self.define_from_variant("BUILD_PYTHON_BINDINGS", "python"),
self.define_from_variant("BUILD_R_BINDINGS", "r"),

View File

@@ -15,7 +15,6 @@ class Mold(CMakePackage):
license("MIT")
version("2.36.0", sha256="3f57fe75535500ecce7a80fa1ba33675830b7d7deb1e5ee9a737e2bc43cdb1c7")
version("2.35.1", sha256="912b90afe7fde03e53db08d85a62c7b03a57417e54afc72c08e2fa07cab421ff")
version("2.35.0", sha256="2703f1c88c588523815886478950bcae1ef02190dc4787e0d120a293b1a46e3b")
version("2.34.1", sha256="a8cf638045b4a4b2697d0bcc77fd96eae93d54d57ad3021bf03b0333a727a59d")

View File

@@ -147,9 +147,11 @@ def _copy_arch_file(self, lib):
def _append_option(self, opts, lib):
if lib != "python":
self._copy_arch_file(lib)
lib_pkg = self[lib]
spec = self.spec
lib_prefix = (
lib_pkg.component_prefix if lib_pkg.name == "intel-oneapi-mkl" else lib_pkg.prefix
spec[lib].package.component_prefix
if spec[lib].name == "intel-oneapi-mkl"
else spec[lib].prefix
)
opts.extend(["--with-{0}".format(lib), "--{0}-prefix".format(lib), lib_prefix])

View File

@@ -35,7 +35,7 @@ class Nfft(AutotoolsPackage):
@property
def fftw_selected_precisions(self):
if not self._fftw_precisions:
self._fftw_precisions = self["fftw"].selected_precisions
self._fftw_precisions = self.spec["fftw"].package.selected_precisions
return self._fftw_precisions
def configure(self, spec, prefix):

View File

@@ -36,27 +36,13 @@ class Ninja(Package):
version("1.7.2", sha256="2edda0a5421ace3cf428309211270772dd35a91af60c96f93f90df6bc41b16d9")
version("1.6.0", sha256="b43e88fb068fe4d92a3dfd9eb4d19755dae5c33415db2e9b7b61b4659009cde7")
# ninja@1.12: needs googletest source, but 1.12 itself needs a patch to use it
resource(
name="googletest",
url="https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz",
sha256="81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
placement="gtest",
when="@1.12:",
)
patch(
"https://github.com/ninja-build/ninja/commit/f14a949534d673f847c407644441c8f37e130ce9.patch?full_index=1",
sha256="93f4bb3234c3af04e2454c6f0ef2eca3107edd4537a70151ea66f1a1d4c22dad",
when="@1.12",
)
depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
variant(
"re2c", default=not sys.platform == "win32", description="Enable buidling Ninja with re2c"
)
depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
depends_on("python", type="build")
depends_on("re2c@0.11.3:", type="build", when="+re2c")
@@ -68,10 +54,7 @@ def determine_version(cls, exe):
return output.strip()
def configure(self, spec, prefix):
if self.run_tests and spec.satisfies("@1.12:"):
python("configure.py", "--bootstrap", "--gtest-source-dir=gtest")
else:
python("configure.py", "--bootstrap")
python("configure.py", "--bootstrap")
@run_after("configure")
@on_package_attributes(run_tests=True)

View File

@@ -78,10 +78,7 @@ def install(self, spec, prefix):
string=True,
)
if self.spec.satisfies("@4.8.0:"):
base_args += [f"CC={self.compiler.cc}"]
configure(*(base_args))
configure(*(base_args), f"CC={self.compiler.cc}")
make("world.opt")
make("install", "PREFIX={0}".format(prefix))

View File

@@ -84,10 +84,10 @@ def post_install(self):
pyso = "pyopenvdb.dylib"
else:
pyso = "pyopenvdb.so"
pyver = f"python{self['python'].version.up_to(2)}"
pyver = "python{0}".format(spec["python"].package.version.up_to(2))
src = self.prefix.lib.join(pyver).join(pyso)
src = prefix.lib.join(pyver).join(pyso)
if not os.path.isfile(src):
src = self.prefix.lib64.join(pyver).join(pyso)
src = prefix.lib64.join(pyver).join(pyso)
assert os.path.isfile(src)
os.rename(src, os.path.join(python_platlib, pyso))

View File

@@ -21,11 +21,11 @@ def home(self):
@property
def headers(self):
return self["mesa"].libosmesa_headers
return self.spec["mesa"].package.libosmesa_headers
@property
def libs(self):
return self["mesa"].libosmesa_libs
return self.spec["mesa"].package.libosmesa_libs
@property
def gl_headers(self):
@@ -33,4 +33,4 @@ def gl_headers(self):
@property
def gl_libs(self):
return self["mesa"].libosmesa_libs
return self.spec["mesa"].package.libosmesa_libs

View File

@@ -19,8 +19,7 @@ class Palace(CMakePackage):
version("0.12.0", tag="v0.12.0", commit="8c192071206466638d5818048ee712e1fada386f")
version("0.11.2", tag="v0.11.2", commit="6c3aa5f84a934a6ddd58022b2945a1bdb5fa329d")
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("cxx", type="build") # generated
variant("shared", default=True, description="Build shared libraries")
variant("int64", default=False, description="Use 64 bit integers")

View File

@@ -31,7 +31,7 @@ class Pnfft(AutotoolsPackage):
@property
def fftw_selected_precisions(self):
if not self._fftw_precisions:
self._fftw_precisions = self["fftw"].selected_precisions
self._fftw_precisions = self.spec["fftw"].package.selected_precisions
return self._fftw_precisions
def configure(self, spec, prefix):

View File

@@ -16,12 +16,9 @@ class PyArrow(PythonPackage):
homepage = "https://arrow.readthedocs.io/en/latest/"
pypi = "arrow/arrow-0.16.0.tar.gz"
maintainers("climbfuji")
license("Apache-2.0")
# https://github.com/spack/spack/issues/48477
# version("1.3.0", sha256="d4540617648cb5f895730f1ad8c82a65f2dad0166f57b75f3ca54759c4d67a85")
version("1.3.0", sha256="d4540617648cb5f895730f1ad8c82a65f2dad0166f57b75f3ca54759c4d67a85")
version("1.2.3", sha256="3934b30ca1b9f292376d9db15b19446088d12ec58629bc3f0da28fd55fb633a1")
version("1.2.2", sha256="05caf1fd3d9a11a1135b2b6f09887421153b94558e5ef4d090b567b47173ac2b")
version("1.2.1", sha256="c2dde3c382d9f7e6922ce636bf0b318a7a853df40ecb383b29192e6c5cc82840")
@@ -29,15 +26,12 @@ class PyArrow(PythonPackage):
version("0.14.7", sha256="67f8be7c0cf420424bc62d8d7dc40b44e4bb2f7b515f9cc2954fb36e35797656")
version("0.14.1", sha256="2d30837085011ef0b90ff75aa0a28f5c7d063e96b7e76b6cbc7e690310256685")
# https://github.com/spack/spack/issues/48477
# depends_on("python@3.8:", type=("build", "run"), when="@1.3:")
depends_on("python@3.8:", type=("build", "run"), when="@1.3:")
depends_on("python@3.6:", type=("build", "run"), when="@1.2.1:")
depends_on("python@2.7:2.8,3.5:", type=("build", "run"), when="@:0.16.0")
depends_on("py-setuptools", type="build", when="@:1.2")
# https://github.com/spack/spack/issues/48477
# depends_on("py-flit-core@3.2:3", type="build", when="@1.3:")
depends_on("py-flit-core@3.2:3", type="build", when="@1.3:")
depends_on("py-python-dateutil", type=("build", "run"))
depends_on("py-typing-extensions", type=("build", "run"), when="@1.2.1:1.2 ^python@:3.7")
depends_on("py-python-dateutil@2.7.0:", type=("build", "run"), when="@1.2.1:")
# https://github.com/spack/spack/issues/48477
# depends_on("py-types-python-dateutil@2.8.10:", type=("build", "run"), when="@1.3:")
depends_on("py-types-python-dateutil@2.8.10:", type=("build", "run"), when="@1.3:")

View File

@@ -10,20 +10,16 @@ class PyCylcFlow(PythonPackage):
homepage = "https://cylc.org"
pypi = "cylc-flow/cylc-flow-8.1.4.tar.gz"
git = "https://github.com/cylc/cylc-flow.git"
maintainers("LydDeb", "climbfuji")
license("GPL-3.0-only")
# Version 8.3.6 is available at PyPI, but not at the URL that is considered canonical by Spack
# https://github.com/spack/spack/issues/48479
version("8.3.6", commit="7f63b43164638e27636b992b14b3fa088b692b94")
version("8.2.3", sha256="dd5bea9e4b8dad00edd9c3459a38fb778e5a073da58ad2725bc9b84ad718e073")
version("8.2.0", sha256="cbe35e0d72d1ca36f28a4cebe9b9040a3445a74253bc94051a3c906cf179ded0")
version("8.1.4", sha256="d1835ac18f6f24f3115c56b2bc821185484e834a86b12fd0033ff7e4dc3c1f63")
depends_on("py-setuptools@49:66,68:", type=("build", "run"), when="@:8.2")
depends_on("py-setuptools@49:66,68:", type=("build", "run"))
depends_on("py-aiofiles@0.7", type=("build", "run"), when="@:8.1")
depends_on("py-ansimarkup@1.0.0:", type=("build", "run"))
depends_on("py-async-timeout@3.0.0:", type=("build", "run"))
@@ -32,20 +28,15 @@ class PyCylcFlow(PythonPackage):
depends_on("py-jinja2@3.0", type=("build", "run"))
depends_on("py-metomi-isodatetime@3.0", type=("build", "run"), when="@:8.2.0")
depends_on("py-metomi-isodatetime@3:3.1", type=("build", "run"), when="@8.2.3:")
depends_on("py-packaging", type=("build", "run"), when="@8.3:")
depends_on("py-protobuf@4.21.2:4.21", type=("build", "run"), when="@:8.2")
depends_on("py-protobuf@4.24.4:4.24", type=("build", "run"), when="@8.3:")
depends_on("py-protobuf@4.21.2:4.21", type=("build", "run"))
depends_on("py-psutil@5.6.0:", type=("build", "run"))
depends_on("py-pyzmq@22:", type=("build", "run"), when="@8.2:")
depends_on("py-pyzmq@22", type=("build", "run"), when="@:8.1")
depends_on("py-importlib-metadata", type=("build", "run"), when="@:8.2 ^python@:3.7")
depends_on("py-importlib-metadata@5:", type=("build", "run"), when="@8.3: ^python@:3.11")
depends_on("py-urwid@2:2.6.1,2.6.4:2", type=("build", "run"))
depends_on("py-importlib-metadata", type=("build", "run"), when="^python@:3.7")
depends_on("py-urwid@2", type=("build", "run"))
depends_on("py-rx", type=("build", "run"))
depends_on("py-promise", type=("build", "run"))
depends_on("py-tomli@2:", type=("build", "run"), when="^python@:3.10")
# Non-Python dependencies for creating graphs.
# We want at least the pangocairo variant for
# graphviz so that we can create output as png.
depends_on("graphviz+pangocairo", type="run")
# Non-Python dependencies
depends_on("graphviz", type="run")

View File

@@ -10,26 +10,15 @@ class PyCylcRose(PythonPackage):
homepage = "https://cylc.github.io/cylc-doc/latest/html/plugins/cylc-rose.html"
pypi = "cylc-rose/cylc-rose-1.3.0.tar.gz"
git = "https://github.com/cylc/cylc-rose.git"
maintainers("LydDeb", "climbfuji")
maintainers("LydDeb")
license("GPL-3.0-only")
# Version 1.4.2 is available at PyPI, but not at the URL that is considered canonical by Spack
# https://github.com/spack/spack/issues/48479
version("1.4.2", commit="8deda0480afed8cf92cfdf7938fc78d0aaf0c0e4")
version("1.3.0", sha256="017072b69d7a50fa6d309a911d2428743b07c095f308529b36b1b787ebe7ab88")
depends_on("py-setuptools", type="build")
depends_on("py-metomi-rose@2.1", type=("build", "run"))
depends_on("py-cylc-flow@8.2", type=("build", "run"))
depends_on("py-metomi-isodatetime", type=("build", "run"))
depends_on("py-jinja2", type=("build", "run"))
with when("@1.3.0"):
depends_on("py-metomi-rose@2.1", type=("build", "run"))
depends_on("py-cylc-flow@8.2", type=("build", "run"))
with when("@1.4.2"):
depends_on("py-metomi-rose@2.3", type=("build", "run"))
depends_on("py-cylc-flow@8.3.5:8.3", type=("build", "run"))
depends_on("py-ansimarkup", type=("build", "run"))

View File

@@ -10,31 +10,22 @@ class PyCylcUiserver(PythonPackage):
homepage = "https://github.com/cylc/cylc-uiserver/"
pypi = "cylc-uiserver/cylc-uiserver-1.3.0.tar.gz"
git = "https://github.com/cylc/cylc-uiserver.git"
maintainers("LydDeb", "climbfuji")
maintainers("LydDeb")
license("GPL-3.0-or-later")
# Version 1.5.1 is available at PyPI, but not at the URL that is considered canonical by Spack
# https://github.com/spack/spack/issues/48479
version("1.5.1", commit="3a41c6fbefbcea33c41410f3698de8b62c9871b8")
version("1.3.0", sha256="f3526e470c7ac2b61bf69e9b8d17fc7a513392219d28baed9b1166dcc7033d7a")
depends_on("python@3.8:", when="@1.5.1", type=("build", "run"))
depends_on("py-wheel", type="build")
depends_on("py-setuptools@40.9.0:", type="build")
depends_on("py-cylc-flow@8.2", when="@1.3.0", type=("build", "run"))
depends_on("py-cylc-flow@8.3", when="@1.5.1", type=("build", "run"))
depends_on("py-cylc-flow@8.2", type=("build", "run"))
depends_on("py-ansimarkup@1.0.0:", type=("build", "run"))
depends_on("py-graphene", type=("build", "run"))
depends_on("py-graphene-tornado@2.6", type=("build", "run"))
depends_on("py-graphql-ws@0.4.4", type=("build", "run"))
depends_on("py-jupyter-server@1.10.2:1", when="@1.3.0", type=("build", "run"))
depends_on("py-jupyter-server@2.7:", when="@1.5.1", type=("build", "run"))
depends_on("py-jupyter-server@1.10.2:1", type=("build", "run"))
depends_on("py-requests", type=("build", "run"))
depends_on("py-psutil", when="@1.5.1", type=("build", "run"))
depends_on("py-tornado@6.1.0:", type=("build", "run"))
depends_on("py-traitlets@5.2.1:", type=("build", "run"))
depends_on("py-pyzmq", type=("build", "run"))

View File

@@ -8,66 +8,21 @@
class PyIminuit(PythonPackage):
"""Interactive IPython-Friendly Minimizer based on SEAL Minuit2."""
homepage = "http://github.com/scikit-hep/iminuit"
pypi = "iminuit/iminuit-1.2.tar.gz"
tags = ["hep"]
license("MIT AND LGPL-2.0-only", checked_by="wdconinc")
version("2.30.1", sha256="2815bfdeb8e7f78185f316b75e2d4b19d0f6993bdc5ff03352ed37b70a796360")
version("2.29.1", sha256="474d10eb2f924b9320f6f7093e4c149d0a38c124d0419c12a07a3eca942de025")
version("2.28.0", sha256="6646ae0b66a4760e02cd73711d460a6cf2375382b78ce8344141751595596aad")
version("2.27.0", sha256="4ce830667730e76d20b10416a5851672c7fcc301dd1f48b9143cfd187b89ab8e")
version("2.26.0", sha256="a51233fbf1c2e008aa584f9eea65b6c30ed56624e4dea5d4e53370ccd84c9b4e")
version("2.25.2", sha256="3bf8a1b96865a60cedf29135f4feae09fa7c66237d29f68ded64e97a823a9b3e")
version("2.24.0", sha256="25ab631c3c8e024b1bcc7c96f66338caac54a4a2324d55f1e3ba5617816e44fd")
version("2.23.0", sha256="98f1589eb18d4882232ff1556d62e7ca19c91bbab7524ac8b405261a674452a1")
version("2.22.0", sha256="e0ccc37bad8bc1bd3b9d3fa07d28d4c0407e25a888faa9b559be2d9afbd2d97c")
version("2.21.3", sha256="fb313f0cc27e221b9b221bcd779b3a668fb4c77b0f90abfd5336833ecbdac016")
version("2.20.0", sha256="a73fe6e02f35e3180fc01bc5c1794edf662ff1725c3bc2a4f433567799da7504")
version("2.19.0", sha256="f4d1cbaccf115cdc4866968f649f2a37794a5c0de018de8156aa74556350a54c")
version("2.18.0", sha256="7ee2c6a0bcdac581b38fae8d0f343fdee55f91f1f6a6cc9643fcfbcc6c2dc3e6")
version("2.17.0", sha256="75f4a8a2bad21fda7b6bd42df7ca04120fb24636ebf9b566d259b26f2044b1d0")
version("2.16.0", sha256="1024a519dbc8fd52d5fd2a3779fd485b09bc27c40556def8b6f91695423199d6")
version("2.15.2", sha256="60ac7d2fe9405c9206675229273f401611d3f5dfa22942541646c4625b59f1ea")
version("2.14.0", sha256="5920880d6ec0194411942ab6040a1930398be45669c9f60fff391e666c863417")
version("2.13.0", sha256="e34785c2a2c0aea6ff86672fe81b80a04ac9d42a79ed8249630f2529a8f6a0fa")
version("2.12.2", sha256="29142ed38cf986c08683dc9e912a484abc70962a4d36d7d71b7d9d872316be8e")
version("2.11.2", sha256="8cae7917ca2d22c691e00792bfbbb812b84ac5c75120eb2ae879fb4ada41ee6c")
version("2.10.0", sha256="93b33ca6d2ffd73e80b40e8a400ca3dbc70e05662f1bd390e2b6040279101485")
version("2.9.0", sha256="656410ceffead79a52d3d727fdcd2bac78d7774239bef0efc3b7a86bae000ff3")
version("2.8.4", sha256="4b09189f3094896cfc68596adc95b7f1d92772e1de1424e5dc4dd81def56e8b0")
version("1.5.2", sha256="0b54f4d4fc3175471398b573d24616ddb8eb7d63808aa370cfc71fc1d636a1fd")
version("1.3.7", sha256="9173e52cc4a0c0bda13ebfb862f9b074dc5de345b23cb15c1150863aafd8a26c")
version("1.3.6", sha256="d79a197f305d4708a0e3e52b0a6748c1a6997360d2fbdfd09c022995a6963b5e")
version("1.2", sha256="7651105fc3f186cfb5742f075ffebcc5088bf7797d8ed124c00977eebe0d1c64")
depends_on("cxx", type="build")
depends_on("cxx", type="build") # generated
# Required dependencies
depends_on("python@3.6:", type=("build", "run"), when="@2.6.1:")
depends_on("python@3.7:", type=("build", "run"), when="@2.17.0:")
depends_on("python@3.8:", type=("build", "run"), when="@2.19.0:")
depends_on("python@3.9:", type=("build", "run"), when="@2.28.0:")
with when("@2.22:"):
depends_on("py-scikit-build-core@0.3:+pyproject", type="build")
depends_on("py-scikit-build-core@0.5:+pyproject", type="build", when="@2.26:")
depends_on("py-pybind11", type="build")
depends_on("py-pybind11@2.12:", type="build", when="@2.26:")
with when("@:2.21"):
depends_on("py-setuptools", type="build")
depends_on("py-setuptools", type="build")
depends_on("py-numpy", type=("build", "run"), when="@1.3:1.3.6")
depends_on("py-numpy@1.11.3:", type=("build", "run"), when="@1.3.7:")
# https://github.com/numpy/numpy/issues/26191#issuecomment-2179127999
depends_on("py-numpy@1.21:", type=("build", "run"), when="@2.22:")
depends_on("py-numpy@:1", when="@:2.25", type=("build", "run"))
depends_on("cmake@3.11:", type="build")
depends_on("cmake@3.13:", type="build", when="@2:")
depends_on("cmake@3.15:", type="build", when="@2.22:")
# Historical dependencies
with when("@:2.27"):
depends_on("py-typing-extensions", when="@2.21: ^python@:3.8", type=("build", "run"))
depends_on(
"py-typing-extensions@3.7.4:", when="@2.26: ^python@:3.8", type=("build", "run")
)
depends_on("cmake", type="build", when="@2.8.4")

View File

@@ -22,7 +22,6 @@ class PyKeras(PythonPackage):
maintainers("adamjstewart")
license("Apache-2.0")
version("3.8.0", sha256="6289006e6f6cb2b68a563b58cf8ae5a45569449c5a791df6b2f54c1877f3f344")
version("3.7.0", sha256="a4451a5591e75dfb414d0b84a3fd2fb9c0240cc87ebe7e397f547ce10b0e67b7")
version("3.6.0", sha256="405727525a3522ed8f9ec0b46e0667e4c65fcf714a067322c16a00d902ded41d")
version("3.5.0", sha256="53ae4f9472ec9d9c6941c82a3fda86969724ace3b7630a94ba0a1f17ba1065c3")
@@ -65,7 +64,6 @@ class PyKeras(PythonPackage):
version("2.2.1", sha256="0d3cb14260a3fa2f4a5c4c9efa72226ffac3b4c50135ba6edaf2b3d1d23b11ee")
version("2.2.0", sha256="5b8499d157af217f1a5ee33589e774127ebc3e266c833c22cb5afbb0ed1734bf")
# TODO: add openvino backend (keras 3.8+)
variant(
"backend",
default="tensorflow",
@@ -87,6 +85,7 @@ class PyKeras(PythonPackage):
depends_on("py-absl-py", when="@2.6:")
depends_on("py-numpy")
depends_on("py-rich", when="@3:")
depends_on("py-namex@0.0.8:", when="@3.3.3:")
depends_on("py-namex", when="@3:")
depends_on("py-h5py")
depends_on("py-optree", when="@3.1:")
@@ -94,21 +93,22 @@ class PyKeras(PythonPackage):
depends_on("py-packaging", when="@3.4:")
# requirements-common.txt
# Many more (optional?) dependencies
depends_on("py-scipy")
depends_on("py-pandas")
depends_on("py-requests", when="@3:")
depends_on("py-protobuf", when="@3:")
# requirements-tensorflow-cuda.txt
with when("backend=tensorflow"):
depends_on("py-tensorflow@2.18", when="@3.7:")
depends_on("py-tensorflow@2.17", when="@3.5:3.6")
depends_on("py-tensorflow@2.16.1:2.16", when="@3.0:3.4")
# depends_on("py-tf2onnx", when="@3.8:")
# requirements-jax-cuda.txt
with when("backend=jax"):
depends_on("py-jax@0.4.28", when="@3.6:")
depends_on("py-jax@0.4.23", when="@3.0.5:3.5")
depends_on("py-jax", when="@3:")
# depends_on("py-flax", when="@3.2:")
# requirements-torch-cuda.txt
with when("backend=torch"):
@@ -126,7 +126,6 @@ class PyKeras(PythonPackage):
depends_on("py-torchvision@0.16.2", when="@3.0.3:3.0.5")
depends_on("py-torchvision@0.16.1", when="@3.0.1:3.0.2")
depends_on("py-torchvision@0.16.0", when="@3.0.0")
# depends_on("py-torch-xla", when="@3.8:")
# Historical dependencies
with default_args(type="build"):

View File

@@ -11,11 +11,10 @@ class PyMetomiRose(PythonPackage):
homepage = "https://metomi.github.io/rose/doc/html/index.html"
pypi = "metomi-rose/metomi-rose-2.1.0.tar.gz"
maintainers("LydDeb", "climbfuji")
maintainers("LydDeb")
license("GPL-3.0-only")
version("2.3.2", sha256="5d2a1593a5bbe8362fbe5e197eaa0cde2574700c62181d9b5c1fafa1e67656cd")
version("2.1.0", sha256="1b60135a434fe4325d364a57e8f5e81e90f39b373b9d68733458c1adc2513c05")
depends_on("fortran", type="build") # generated
@@ -29,6 +28,3 @@ class PyMetomiRose(PythonPackage):
depends_on("py-psutil@5.6.0:", type=("build", "run"))
depends_on("py-requests", type=("build", "run"))
depends_on("py-sqlalchemy@1", type=("build", "run"))
depends_on("py-importlib-metadata@5:", when="@2.3.2 ^python@:3.11")
depends_on("py-importlib-resources@2:", when="@2.3.2 ^python@:3.8")

View File

@@ -1,20 +0,0 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyNeo4j(PythonPackage):
"""This is the neo4j bolt driver for python from the official repository"""
pypi = "neo4j/neo4j-5.25.0.tar.gz"
license("LGPL-3.0-only")
version("5.25.0", sha256="7c82001c45319092cc0b5df4c92894553b7ab97bd4f59655156fa9acab83aec9")
depends_on("py-pytz", type="run")
depends_on("py-setuptools@68.0.0", type="build")
depends_on("py-tomlkit@0.11.8", type="build")
depends_on("python@3.7.0:", type=("build", "run"))

View File

@@ -15,7 +15,6 @@ class PyNetcdf4(PythonPackage):
license("MIT")
version("1.7.2", sha256="a4c6375540b19989896136943abb6d44850ff6f1fa7d3f063253b1ad3f8b7fce")
version(
"1.7.1.post2", sha256="37d557e36654889d7020192bfb56f9d5f93894cb32997eb837ae586c538fd7b6"
)
@@ -28,7 +27,6 @@ class PyNetcdf4(PythonPackage):
variant("mpi", default=True, description="Parallel IO support")
depends_on("python", type=("build", "link", "run"))
depends_on("python@3.8:", when="@1.7.1:", type=("build", "link", "run"))
depends_on("py-cython@0.29:", when="@1.6.5:", type="build")
depends_on("py-cython@0.19:", type="build")
depends_on("py-setuptools@61:", when="@1.6.5:", type="build")
@@ -37,17 +35,15 @@ class PyNetcdf4(PythonPackage):
depends_on("py-setuptools-scm@3.4:+toml", when="@1.7:", type="build")
depends_on("py-cftime", type=("build", "run"))
depends_on("py-certifi", when="@1.6.5:", type=("build", "run"))
depends_on("py-numpy", type=("build", "link", "run"))
depends_on("py-numpy@2.0:", when="@1.7.1:", type=("build", "link", "run"))
depends_on("py-numpy", when="@1.6.5:", type=("build", "link", "run"))
depends_on("py-numpy@1.9:", when="@1.5.4:1.6.2", type=("build", "link", "run"))
depends_on("py-numpy@1.7:", type=("build", "link", "run"))
# https://github.com/Unidata/netcdf4-python/pull/1317
depends_on("py-numpy@:1", when="@:1.6", type=("build", "link", "run"))
depends_on("py-mpi4py", when="+mpi", type=("build", "run"))
# These forced variant requests are due to py-netcdf4 build scripts
# https://github.com/spack/spack/pull/47824#discussion_r1882473998
depends_on("netcdf-c~mpi", when="~mpi")
depends_on("netcdf-c", when="-mpi")
depends_on("netcdf-c+mpi", when="+mpi")
depends_on("hdf5@1.8.0:+hl~mpi", when="~mpi")
depends_on("hdf5@1.8.0:+hl", when="-mpi")
depends_on("hdf5@1.8.0:+hl+mpi", when="+mpi")
# The installation script tries to find hdf5 using pkg-config. However, the
@@ -61,7 +57,7 @@ class PyNetcdf4(PythonPackage):
patch(
"https://github.com/Unidata/netcdf4-python/commit/49dcd0b5bd25824c254770c0d41445133fc13a46.patch?full_index=1",
sha256="71eefe1d3065ad050fb72eb61d916ae1374a3fafd96ddaee6499cda952d992c4",
when="@1.6:1.6.5 %gcc@14:",
when="@1.6: %gcc@14:",
)
def url_for_version(self, version):

View File

@@ -1,33 +0,0 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyNvitop(PythonPackage):
"""
An interactive NVIDIA-GPU process viewer and beyond,
the one-stop solution for GPU process management.
"""
homepage = "https://nvitop.readthedocs.io/"
pypi = "nvitop/nvitop-1.4.0.tar.gz"
maintainers("nboelte")
license("Apache-2.0", checked_by="nboelte")
version("1.4.0", sha256="92f313e9bd89fe1a9d54054e92f490f34331f1b7847a89ddaffd6a7fde1437bb")
depends_on("py-nvidia-ml-py@11.450.51:12.561", type=("build", "run"))
depends_on("py-psutil@5.6.6:", type=("build", "run"))
depends_on("py-cachetools@1.0.1:", type=("build", "run"))
depends_on("py-termcolor@1.0.0:", type=("build", "run"))
depends_on("python@3.7:", type=("build", "run"))
depends_on("py-setuptools", type="build")
# Windows support would require the package py-windows-curses to be available in spack.
# depends_on("py-colorama@0.4:", when="platform=windows", type=("build", "run"))
# depends_on("py-windows-curses@2.2.0:", when="platform=windows", type=("build", "run"))
conflicts("platform=windows")

View File

@@ -20,7 +20,6 @@ class PyProtobuf(PythonPackage):
version("5.27.5", sha256="7fa81bc550201144a32f4478659da06e0b2ebe4d5303aacce9a202a1c3d5178d")
version("5.26.1", sha256="8ca2a1d97c290ec7b16e4e5dff2e5ae150cc1582f55b5ab300d45cb0dfa90e51")
version("4.25.3", sha256="25b5d0b42fd000320bd7830b349e3b696435f3b329810427a6bcce6a5492cc5c")
version("4.24.4", sha256="5a70731910cd9104762161719c3d883c960151eea077134458503723b60e3667")
version("4.24.3", sha256="12e9ad2ec079b833176d2921be2cb24281fa591f0b119b208b788adc48c2561d")
version("4.23.3", sha256="7a92beb30600332a52cdadbedb40d33fd7c8a0d7f549c440347bc606fb3fe34b")
version("4.21.9", sha256="61f21493d96d2a77f9ca84fefa105872550ab5ef71d21c458eb80edcf4885a99")

View File

@@ -43,7 +43,7 @@ def configure_args(self):
"--sip",
self.spec["py-sip"].prefix.bin.sip,
"--sip-incdir",
join_path(self.spec["py-sip"].prefix, self["python"].include),
join_path(self.spec["py-sip"].prefix, self.spec["python"].package.include),
"--bindir",
self.prefix.bin,
"--destdir",

View File

@@ -14,40 +14,24 @@ class PySegmentationModelsPytorch(PythonPackage):
license("MIT")
maintainers("adamjstewart")
version("0.4.0", sha256="8833e63f0846090667be6fce05a2bbebbd1537776d3dea72916aa3db9e22e55b")
with default_args(deprecated=True):
version("0.3.4", sha256="f4aee7f6add479bd3c3953e855b7055fc657dc6800bf7fc8ab733fd7f8acb163")
version("0.3.3", sha256="b3b21ab4cd26a6b2b9e7a6ed466ace6452eb26ed3c31ae491ea2d7cbb01e384b")
version("0.3.2", sha256="8372733e57a10cb8f6b9e18a20577fbb3fb83549b6945664dc774a9b6d3ecd13")
version("0.3.1", sha256="d4a4817cf48872c3461bb7d22864c00f9d491719a6460adb252c035f9b0e8d51")
version("0.3.0", sha256="8e00ed1707698d309d23f207aef15f21465e091aa0f1dc8043ec3300f5f67216")
version("0.2.1", sha256="86744552b04c6bedf7e10f7928791894d8d9b399b9ed58ed1a3236d2bf69ead6")
version("0.2.0", sha256="247266722c23feeef16b0862456c5ce815e5f0a77f95c2cd624a71bf00d955df")
version("0.3.4", sha256="f4aee7f6add479bd3c3953e855b7055fc657dc6800bf7fc8ab733fd7f8acb163")
version("0.3.3", sha256="b3b21ab4cd26a6b2b9e7a6ed466ace6452eb26ed3c31ae491ea2d7cbb01e384b")
version("0.3.2", sha256="8372733e57a10cb8f6b9e18a20577fbb3fb83549b6945664dc774a9b6d3ecd13")
version("0.3.1", sha256="d4a4817cf48872c3461bb7d22864c00f9d491719a6460adb252c035f9b0e8d51")
version("0.3.0", sha256="8e00ed1707698d309d23f207aef15f21465e091aa0f1dc8043ec3300f5f67216")
version("0.2.1", sha256="86744552b04c6bedf7e10f7928791894d8d9b399b9ed58ed1a3236d2bf69ead6")
version("0.2.0", sha256="247266722c23feeef16b0862456c5ce815e5f0a77f95c2cd624a71bf00d955df")
with default_args(type="build"):
depends_on("py-setuptools@61:", when="@0.4:")
depends_on("py-setuptools")
with default_args(type=("build", "run")):
depends_on("py-efficientnet-pytorch@0.6.1:", when="@0.4:")
depends_on("py-efficientnet-pytorch@0.7.1", when="@0.3")
depends_on("py-efficientnet-pytorch@0.6.3", when="@:0.2")
depends_on("py-huggingface-hub@0.24:", when="@0.4:")
depends_on("py-huggingface-hub@0.24.6:", when="@0.3.4:0.3")
depends_on("py-numpy@1.19.3:", when="@0.4:")
depends_on("pil@8:", when="@0.4:")
depends_on("pil", when="@0.3:")
depends_on("py-pretrainedmodels@0.7.1:", when="@0.4:")
depends_on("py-pretrainedmodels@0.7.4", when="@:0.3")
depends_on("py-six@1.5:", when="@0.4:")
depends_on("py-six", when="@0.3.4:")
depends_on("py-timm@0.9:", when="@0.4:")
depends_on("py-timm@0.9.7", when="@0.3.4")
depends_on("py-timm@0.9.2", when="@0.3.3")
depends_on("py-timm@0.6.12", when="@0.3.2")
depends_on("py-timm@0.4.12", when="@:0.3.1")
depends_on("py-torch@1.8:", when="@0.4:")
depends_on("py-torchvision@0.9:", when="@0.4:")
depends_on("py-torchvision@0.5:")
depends_on("py-tqdm@4.42.1:", when="@0.4:")
depends_on("py-tqdm", when="@0.3:")
depends_on("py-setuptools", type="build")
depends_on("py-torchvision@0.5.0:", type=("build", "run"))
depends_on("py-pretrainedmodels@0.7.4", type=("build", "run"))
depends_on("py-efficientnet-pytorch@0.7.1", when="@0.3:", type=("build", "run"))
depends_on("py-efficientnet-pytorch@0.6.3", when="@:0.2", type=("build", "run"))
depends_on("py-timm@0.9.7", when="@0.3.4", type=("build", "run"))
depends_on("py-timm@0.9.2", when="@0.3.3", type=("build", "run"))
depends_on("py-timm@0.6.12", when="@0.3.2", type=("build", "run"))
depends_on("py-timm@0.4.12", when="@:0.3.1", type=("build", "run"))
depends_on("py-huggingface-hub@0.24.6:", when="@0.3.4:", type=("build", "run"))
depends_on("py-tqdm", when="@0.3:", type=("build", "run"))
depends_on("pil", when="@0.3:", type=("build", "run"))
depends_on("py-six", when="@0.3.4:", type=("build", "run"))

View File

@@ -71,7 +71,7 @@ def install(self, spec, prefix):
"--sip-module={0}".format(spec.variants["module"].value),
"--bindir={0}".format(prefix.bin),
"--destdir={0}".format(python_platlib),
"--incdir={0}".format(join_path(prefix, self["python"].include)),
"--incdir={0}".format(join_path(prefix, spec["python"].package.include)),
"--sipdir={0}".format(prefix.share.sip),
"--stubsdir={0}".format(python_platlib),
]

View File

@@ -13,11 +13,6 @@ class PyStevedore(PythonPackage):
license("Apache-2.0")
version("5.4.0", sha256="79e92235ecb828fe952b6b8b0c6c87863248631922c8e8e0fa5b17b232c4514d")
version("5.3.0", sha256="9a64265f4060312828151c204efbe9b7a9852a0d9228756344dbc7e4023e375a")
version("5.2.0", sha256="46b93ca40e1114cea93d738a6c1e365396981bb6bb78c27045b7587c9473544d")
version("5.1.0", sha256="a54534acf9b89bc7ed264807013b505bf07f74dbe4bcfa37d32bd063870b087c")
version("5.0.0", sha256="2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021")
version("4.0.0", sha256="f82cc99a1ff552310d19c379827c2c64dd9f85a38bcd5559db2470161867b786")
version("3.5.0", sha256="f40253887d8712eaa2bb0ea3830374416736dc8ec0e22f5a65092c1174c44335")
version("1.28.0", sha256="f1c7518e7b160336040fee272174f1f7b29a46febb3632502a8f2055f973d60b")

View File

@@ -14,7 +14,6 @@ class PyTimm(PythonPackage):
license("Apache-2.0")
maintainers("adamjstewart")
version("1.0.12", sha256="9da490683bd06302ec40e1892f1ccf87985f033e41f3580887d886b9aee9449a")
version("1.0.11", sha256="a005f72b87e67ed30cdbf405a9ffd4e723360c780a43b1cefe266af8ecc9d151")
version("0.9.7", sha256="2bfb1029e90b72e65eb9c75556169815f2e82257eaa1f6ebd623a4b4a52867a2")
version("0.9.5", sha256="669835f0030cfb2412c464b7b563bb240d4d41a141226afbbf1b457e4f18cff1")
@@ -33,15 +32,15 @@ class PyTimm(PythonPackage):
with default_args(type=("build", "run")):
# https://github.com/huggingface/pytorch-image-models/issues/1530
# https://github.com/huggingface/pytorch-image-models/pull/1649
depends_on("python@:3.10", when="@:0.6.12")
depends_on("python@:3.10", when="@:0.6.12", type=("build", "run"))
depends_on("py-torch@1.7:", when="@0.6:")
depends_on("py-torch@1.4:")
depends_on("py-torchvision")
depends_on("py-pyyaml", when="@0.6:")
depends_on("py-huggingface-hub", when="@0.6:")
depends_on("py-safetensors", when="@0.9:")
depends_on("py-torch@1.7:", when="@0.6:", type=("build", "run"))
depends_on("py-torch@1.4:", type=("build", "run"))
depends_on("py-torchvision", type=("build", "run"))
depends_on("py-pyyaml", when="@0.6:", type=("build", "run"))
depends_on("py-huggingface-hub", when="@0.6:", type=("build", "run"))
depends_on("py-safetensors", when="@0.9:", type=("build", "run"))
# https://github.com/rwightman/pytorch-image-models/pull/1256
depends_on("pil@:9", when="@:0.5")
depends_on("py-numpy", when="@:0.5")
depends_on("pil@:9", when="@:0.5", type=("build", "run"))
depends_on("py-numpy", when="@:0.5", type=("build", "run"))

View File

@@ -217,7 +217,9 @@ def fix_qsci_sip(self):
elif "^py-pyqt6" in self.spec:
pyqtx = "PyQt6"
sip_inc_dir = join_path(self["qscintilla"].module.python_platlib, pyqtx, "bindings")
sip_inc_dir = join_path(
self.spec["qscintilla"].package.module.python_platlib, pyqtx, "bindings"
)
with open(join_path("python", "gui", "pyproject.toml.in"), "a") as tomlfile:
tomlfile.write(f'\n[tool.sip.project]\nsip-include-dirs = ["{sip_inc_dir}"]\n')

View File

@@ -101,7 +101,9 @@ def make_qsci_python(self):
with working_dir(join_path(self.stage.source_path, "Python")):
copy(ftoml, "pyproject.toml")
sip_inc_dir = join_path(self[py_pyqtx].module.python_platlib, pyqtx, "bindings")
sip_inc_dir = join_path(
self.spec[py_pyqtx].package.module.python_platlib, pyqtx, "bindings"
)
with open("pyproject.toml", "a") as tomlfile:
# https://pyqt-builder.readthedocs.io/en/latest/pyproject_toml.html

View File

@@ -13,11 +13,9 @@ class RDeseq2(RPackage):
sequencing assays and test for differential expression based on a model
using the negative binomial distribution."""
bioc = "DESeq2"
homepage = "https://bioconductor.org/packages/DESeq2"
git = "https://git.bioconductor.org/packages/DESeq2.git"
version("1.46.0", commit="4887eb42fa96fcc234118ead8ffd11032a8f08bb")
version("1.44.0", commit="5facd3093468ce2e75a2b742b1533efee13e5818")
version("1.42.0", commit="17a39b5296cb3d897f1e2a9aa4bebbdefb13b46a")
version("1.40.0", commit="c4962c3b16546e552fbc1a712258e4e21ff44241")
version("1.38.0", commit="0e059f425d4ce6a5203685a4ad434f15bbd6e211")
version("1.36.0", commit="2800b78ae52c0600f7e603c54af59beed3a2ed17")

View File

@@ -16,14 +16,6 @@ class RSparsematrixstats(RPackage):
bioc = "sparseMatrixStats"
# The repository is at
# https://code.bioconductor.org/browse/sparseMatrixStats/, to find the
# commit hash check the branch corresponding to a BioConductor release and
# the latest commit (or one of the latest ones) should be the one bumping
# the r-sparsematrixstats version.
version("1.18.0", commit="172c63ee6c8fa200d2fda5546750ab5ac8ddd858")
version("1.16.0", commit="2ad650c393497263c20d67d45d1a56ee6fa3b402")
version("1.14.0", commit="2923a3bb4e59cf0e05f0e21a8e8df66e670c4abc")
version("1.12.0", commit="054bf939cd7220deaf8e768ff7029d0d38483c91")
version("1.10.0", commit="75d85ba2c9c4c36887fef1a007883167aa85bd94")
version("1.8.0", commit="4f1e2213e5b0d6b3d817c2c9129b7566288916f6")
@@ -37,7 +29,4 @@ class RSparsematrixstats(RPackage):
depends_on("r-rcpp", type=("build", "run"))
depends_on("r-matrix", type=("build", "run"))
depends_on("r-matrixstats", type=("build", "run"))
depends_on("r-matrixstats@0.60.0:0.63.0", type=("build", "run"), when="@1.6.0:1.12")
# r-sparsematrixstats 1.12- is incompatible with r-matrixstats v1:
# https://github.com/HenrikBengtsson/matrixStats/issues/227
depends_on("r-matrixstats@1:", type=("build", "run"), when="@1.13.0:")
depends_on("r-matrixstats@0.60.0:", type=("build", "run"), when="@1.6.0:")

View File

@@ -38,11 +38,14 @@ class Remhos(MakefilePackage):
@property
def build_targets(self):
return [
f"MFEM_DIR={self['mfem'].prefix}",
f"CONFIG_MK={self['mfem'].config_mk}",
f"TEST_MK={self['mfem'].test_mk}",
]
targets = []
spec = self.spec
targets.append("MFEM_DIR=%s" % spec["mfem"].prefix)
targets.append("CONFIG_MK=%s" % spec["mfem"].package.config_mk)
targets.append("TEST_MK=%s" % spec["mfem"].package.test_mk)
return targets
# See lib/spack/spack/build_systems/makefile.py
def check(self):

View File

@@ -142,7 +142,7 @@ class Root(CMakePackage):
patch(
"https://github.com/root-project/root/commit/2f00d6df258906c1f6fe848135a88b836db3077f.patch?full_index=1",
sha256="8da36032082e65ae246c03558a4c3fd67b157d1d0c6d20adac9de263279d1db6",
when="@6.28.6:6.28.12",
when="@6.28:6.28.12",
)
patch(
"https://github.com/root-project/root/commit/14838b35600b08278e69bc3d8d8669773bc11399.patch?full_index=1",
@@ -452,8 +452,6 @@ class Root(CMakePackage):
"cxxstd=20", when="@:6.28.02", msg="C++20 support requires root version at least 6.28.04"
)
conflicts("%gcc@:10", when="cxxstd=20")
# See https://github.com/root-project/root/issues/11128
conflicts("%clang@16:", when="@:6.26.07", msg="clang 16+ support was added in root 6.26.08")

View File

@@ -93,7 +93,6 @@ class Rust(Package):
depends_on("rust-bootstrap@1.74:1.75", type="build", when="@1.75")
depends_on("rust-bootstrap@1.77:1.78", type="build", when="@1.78")
depends_on("rust-bootstrap@1.80:1.81", type="build", when="@1.81")
depends_on("rust-bootstrap@1.82:1.83", type="build", when="@1.83")
# src/llvm-project/llvm/cmake/modules/CheckCompilerVersion.cmake
conflicts("%gcc@:7.3", when="@1.73:", msg="Host GCC version must be at least 7.4")

View File

@@ -323,8 +323,8 @@ def install(self, spec, prefix):
env["F77"] = spec["mpi"].mpif77
env["FC"] = spec["mpi"].mpifc
if spec["mpi"].name == "intel-oneapi-mpi":
options.append("-mpiinc=%s/include" % self["mpi"].component_prefix)
options.append("-mpilib=%s/lib" % self["mpi"].component_prefix)
options.append("-mpiinc=%s/include" % spec["mpi"].package.component_prefix)
options.append("-mpilib=%s/lib" % spec["mpi"].package.component_prefix)
else:
options.append("-mpiinc=%s" % spec["mpi"].prefix.include)
options.append("-mpilib=%s" % spec["mpi"].prefix.lib)

View File

@@ -1,98 +0,0 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Toybox(MakefilePackage):
"""All-in-one Linux command line"""
homepage = "https://landley.net/toybox/"
url = "https://landley.net/toybox/downloads/toybox-0.8.11.tar.gz"
git = "https://github.com/landley/toybox.git"
maintainers("Buldram")
license("0BSD", checked_by="Buldram")
version("0.8.11", sha256="15aa3f832f4ec1874db761b9950617f99e1e38144c22da39a71311093bfe67dc")
version("0.8.10", sha256="d3afee05ca90bf425ced73f527e418fecd626c5340b5f58711a14531f8d7d108")
version("0.8.9", sha256="06913dde3de7139b40f947bd7f23869dfc8796e9c6ff39de02719f8b7b2d47ad")
version("0.8.8", sha256="dafd41978d40f02a61cf1be99a2b4a25812bbfb9c3157e679ee7611202d6ac58")
version("0.8.7", sha256="b508bf336f82cb0739b77111f945931d1a143b5a53905cb753cd2607cfdd1494")
version("0.8.6", sha256="4298c90a2b238348e4fdc9f89eb4988356c80da3f0cf78c279d2e82b9119034b")
version("0.8.5", sha256="bfd230c187726347f7e31a1fc5841705871dfe4f3cbc6628f512b54e57360949")
version("0.8.4", sha256="cb2a565a8d30015d08d73628795dca51a85b99b149aeabbbecd9e8dbdbd8fddc")
version("0.8.3", sha256="eab28fd29d19d4e61ef09704e5871940e6f35fd35a3bb1285e41f204504b5c01")
version("0.8.2", sha256="9a2760fa442e9baf1be6064ab5ba8b90f2098e1d4bc33c788960b8d73f52fed5")
version("0.8.1", sha256="1ac41e62b809d2ab656479f7f4e20bb71c63c14473f5c7d13f25d4f7fcfefdb3")
version("0.8.0", sha256="e3ccecd9446db909437427a026c2788f2a96ac7ebc591c95b35df77f4e923956")
version("0.7.8", sha256="4962e16898cb3c6e2719205349c8e6749a30583618a264aa8911f9ad61d998d6")
version("0.7.7", sha256="ee218ab21c80044c04112ada7f59320062c35909a6e5f850b1318b17988ffba0")
version("0.7.6", sha256="e2c9643ebc2bcdec4d8f8db25d0b428dbe0928f7b730052dbbd25db47fb9db95")
version("0.7.5", sha256="3ada450ac1eab1dfc352fee915ea6129b9a4349c1885f1394b61bd2d89a46c04")
version("0.7.4", sha256="49d74ca897501e5c981516719870fe08581726f5c018abe35ef52c6f0de113e7")
conflicts("platform=darwin", when="@:0.7.8,=0.8.1")
conflicts("platform=freebsd", when="@:0.7.8,0.8.1:0.8.8")
variant("userland", default=True, description="Install symlinked individual commands")
variant("static", default=False, description="Build static binary")
variant("ssl", default=True, description="Build with OpenSSL support")
variant("zlib", default=True, description="Build with Zlib support")
depends_on("c", type="build")
depends_on("bash", type="build")
depends_on("sed", type="build")
depends_on("openssl", type="link", when="+ssl")
depends_on("zlib-api", type="link", when="+zlib")
# CVE-2022-32298
patch(
"https://github.com/landley/toybox/commit/6d4847934fc0fe47a3254ce6c0396d197a780cf4.patch?full_index=1",
sha256="2c6ffad53102db23b620fd883636daad15c70a08c72f802a1fbcf96c331280cc",
when="@=0.8.7",
)
# Fixes segfault when building with more recent toolchains.
patch(
"https://github.com/landley/toybox/commit/78289203031afc23585035c362beec10db54958d.patch?full_index=1",
sha256="a27a831eb80f9d46809f619b52018eb2e481758581f7a6932423b95422f23911",
when="@=0.7.4",
)
def setup_build_environment(self, env):
env.set("NOSTRIP", 1)
if not self.spec.satisfies("@=0.8.9"):
env.set("V", 1) # Verbose
if self.spec.satisfies("+static"):
env.append_flags("LDFLAGS", "--static")
def edit(self, spec, prefix):
if spec.satisfies("platform=darwin"):
defconfig = "macos_defconfig"
elif spec.satisfies("platform=freebsd"):
defconfig = "bsd_defconfig"
else:
defconfig = "defconfig"
make(defconfig, parallel=self.parallel and not spec.satisfies("@0.7.8:0.8.1"))
config = FileFilter(".config")
config.filter(
"# CONFIG_TOYBOX_LIBCRYPTO is not set",
"CONFIG_TOYBOX_LIBCRYPTO=" + ("y" if spec.satisfies("+ssl") else "n"),
)
config.filter(
"# CONFIG_TOYBOX_LIBZ is not set",
"CONFIG_TOYBOX_LIBZ=" + ("y" if spec.satisfies("+zlib") else "n"),
)
def install(self, spec, prefix):
if spec.satisfies("+userland"):
make("install_flat", "PREFIX=" + prefix.bin)
else:
mkdir(prefix.bin)
install("toybox", prefix.bin)

View File

@@ -41,7 +41,6 @@ class Verilator(AutotoolsPackage):
version("master", branch="master")
version("5.032", sha256="5a262564b10be8bdb31ff4fb67d77bcf5f52fc1b4e6c88d5ca3264fb481f1e41")
version("5.030", sha256="b9e7e97257ca3825fcc75acbed792b03c3ec411d6808ad209d20917705407eac")
version("5.028", sha256="02d4b6f34754b46a97cfd70f5fcbc9b730bd1f0a24c3fc37223397778fcb142c")
version("5.026", sha256="87fdecf3967007d9ee8c30191ff2476f2a33635d0e0c6e3dbf345cc2f0c50b78")