Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from upstream/develop 2024-12-04 #472

Merged
merged 86 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
eecd4af
gromacs: fix the value used for the ITT directory (#47795)
alalazo Nov 26, 2024
38a2f9c
gromacs: Improve HeFFTe dependency (#47805)
mabraham Nov 26, 2024
0835a3c
gromacs: obtain SYCL from either ACpp or intel-oneapi-runtime (#47806)
mabraham Nov 26, 2024
c037188
gromacs: announce deprecation policy and start to implement (#47804)
mabraham Nov 26, 2024
38b838e
openscenegraph: remove X11 dependencies for macos (#39037)
aumuell Nov 26, 2024
f2ab74e
cray: add further versions of Cray packages. (#37733)
bvanessen Nov 26, 2024
141cdb6
adol-c: fix libs property (#36614)
IHuismann Nov 26, 2024
a546441
siesta: remove link args on a non-declared dependency (#46080)
etiennemlb Nov 26, 2024
fdb9cf2
Intel/oneapi compilers: correct version ranges for diab-disable flag …
climbfuji Nov 26, 2024
cd306d0
all-libary: add voronoi support and git version (#47798)
junghans Nov 26, 2024
0b094f2
Docs: Reference 7z requirement on Windows (#35943)
kwryankrattiger Nov 26, 2024
51ab7ba
julia: conflict for %gcc@12: support (#35931)
heerener Nov 27, 2024
9d33c89
r-rsamtools: add -lz to Makevars (#38649)
snehring Nov 27, 2024
02af41e
gdk-pixbuf: Point at gitlab instead of broken mirror (#47825)
kwryankrattiger Nov 27, 2024
41be2f5
ltr-retriever: changing directory layout (#38513)
snehring Nov 27, 2024
3194be2
gcc-runtime: remove libz.so from libgfortran.so if present (#47812)
haampie Nov 27, 2024
30814fb
Deprecate rsync releases before v3.2.5 (#47820)
drkrynstrng Nov 27, 2024
6b9c099
py-keras: add v3.7.0 (#47816)
adamjstewart Nov 27, 2024
8a64287
raylib: add v5.5 (#47708)
georgemalerbo Nov 27, 2024
2e8db08
build(deps): bump docker/build-push-action from 6.9.0 to 6.10.0 (#47819)
dependabot[bot] Nov 27, 2024
5178543
Patch to fix building [email protected] on darwin. Fixes #45628 (#47830)
Chrismarsh Nov 28, 2024
60e3e64
py-joblib: add v1.4.2 (#47789)
adamjstewart Nov 28, 2024
a042bdf
mapl: add hpcx-mpi (#47793)
mathomp4 Nov 28, 2024
d82bdb3
seacas: update recipe to find faodel (#40239)
payerle Nov 28, 2024
c22d77a
dbcsr: patch for resolving .mod file conflicts in ROCm by implementin…
BOUDAOUD34 Nov 28, 2024
18790ca
py-pyvista: VTK 9.4 not yet supported (#47815)
adamjstewart Nov 28, 2024
192821f
py-river: mark numpy 2 compatibility (#47813)
adamjstewart Nov 28, 2024
f1d6af6
netlib-scalapack: fix for some clang derivative (cce/rocmcc) (#45434)
etiennemlb Nov 28, 2024
d286141
nghttp2: add v1.64.0 (#47800)
hppritcha Nov 28, 2024
69fb594
hypre: add a variant to allow using internal lapack functions (#47780)
victorapm Nov 28, 2024
ecbf9fc
py-scooby: add v0.10.0 (#47790)
adamjstewart Nov 28, 2024
04c76fa
hip: hints for find_package llvm/clang (#47788)
haampie Nov 28, 2024
9bd7483
Add further C and C++ dependencies to packages (#47821)
alalazo Nov 28, 2024
e88a3f6
eospac: version 6.5.12 (#47826)
DarylGrunau Nov 28, 2024
b74db34
darwin: preserve hardlinks on codesign/install_name_tool (#47808)
haampie Nov 28, 2024
cf31d20
add new packages (#47817)
prstrnn Nov 28, 2024
e37e53c
traverse: add MixedDepthVisitor, use in cmake (#47750)
haampie Nov 28, 2024
67d494f
filesystem.py: remove unused md5sum (#47832)
haampie Nov 28, 2024
a96b67c
miopen-hip: add a dependency on c (#47842)
alalazo Nov 29, 2024
06ff8c8
py-torch-sparse: add a dependency on c (#47841)
alalazo Nov 29, 2024
39a65d8
fpm: add a dependency on c, and fortran (#47839)
alalazo Nov 29, 2024
a575fa8
gcc: add missing patches from Iain Sandoe's branch (#47843)
haampie Nov 29, 2024
da7c5c5
py-pip: add v23.2.1 -> v24.3.1 (#47753)
dmagdavector Nov 29, 2024
9760089
VTK: mark Python version compatibility (#47814)
adamjstewart Nov 29, 2024
bf5e6b4
py-mpi4py: create mpi.cfg file, this file is removed since v4.0.0, bu…
tech-91 Nov 29, 2024
c6e292f
py-nbdime: add v3.2.1 (#47445)
wdconinc Nov 29, 2024
2a2d198
`version_types`: clean up type hierarchy and add annotations (#47781)
tgamblin Nov 30, 2024
29427d3
ruff: add v0.8.1 (#47851)
tgamblin Nov 30, 2024
1e37a77
mlpack: depends_on py-setuptools (#47828)
wdconinc Dec 2, 2024
ea5ffe3
configuration: set egl as buildable:false (#47865)
alalazo Dec 2, 2024
f4d81be
py-torch-nvidia-apex: add dependency on C (#47868)
alalazo Dec 2, 2024
eb17680
double-conversion: add dependency on c, and c++ (#47869)
alalazo Dec 2, 2024
5ddbb15
benchmark: add version 1.9.1 (#47860)
stephenswat Dec 2, 2024
8e5a040
ucc: add ROCm and rccl support (#46580)
afzpatel Dec 2, 2024
839ed94
[email protected] revert kokkos-kernel dependency - as this breaks buil…
balay Dec 2, 2024
99319b1
oneapi-level-zero: add dependency on c (#47874)
alalazo Dec 2, 2024
e692d40
amrex: add v24.12 (#47857)
WeiqunZhang Dec 2, 2024
8e7641e
onnx: set CMAKE_CXX_STANDARD to abseil-cpp cxxstd value (#47858)
wdconinc Dec 2, 2024
b5cc5b7
New patch release SLEPc 3.22.2 (#47859)
joseeroman Dec 2, 2024
2ae8eb6
Update HOHQmesh package with newer versions (#47861)
sloede Dec 2, 2024
c30c85a
seacas: add a conditional dependency on fortran (#47871)
alalazo Dec 2, 2024
ac17e8b
utf8cpp: move to GitHub, make it a CMake package (#47870)
alalazo Dec 2, 2024
3017658
py-torchvision: add dependency on c (#47873)
alalazo Dec 2, 2024
ecb8a48
libseccomp: python forward compat bound (#47876)
haampie Dec 2, 2024
d8f2e08
petsc, py-petsc4py: add v3.22.2 (#47845)
balay Dec 2, 2024
3ea9707
add compilers packages (#47877)
prstrnn Dec 2, 2024
6b16c64
acts dependencies: new versions as of 2024/12/02 (#47787)
stephenswat Dec 3, 2024
b9c60f9
build(deps): bump pytest from 8.3.3 to 8.3.4 in /lib/spack/docs (#47882)
dependabot[bot] Dec 3, 2024
bb5bd03
py-rasterio: add v1.4.3 (#47881)
adamjstewart Dec 3, 2024
3a6c361
cgns: make fortran dependency optional (#47867)
alalazo Dec 3, 2024
db090b0
Update package.py (#47885)
napulath Dec 3, 2024
b3ee954
Remove duplicate version (#47880)
aurianer Dec 3, 2024
6da9bf2
python: drop nis module also for < 3.13 (#47862)
haampie Dec 3, 2024
c3de3b0
tar: add v1.35 (fix CVEs) (#47426)
wdconinc Dec 3, 2024
ad7417d
nwchem: add resource, remove patch (#47892)
haampie Dec 3, 2024
b31dd46
style.py: do not remove import spack in packages (#47895)
haampie Dec 3, 2024
09b7ea0
Bump Kokkos and Kokkos-kernels to 4.5.00 (#47809)
cedricchevalier19 Dec 3, 2024
a7eacd7
bug fix: updated warning message to reflect impending v1.0 release (#…
carsonwoods Dec 3, 2024
63c7263
nim: add latest versions (#47844)
Buldram Dec 4, 2024
8898e14
update py-numl and py-nugraph recipes (#47680)
vhewes Dec 4, 2024
b0b9cf1
add a '+no_warning' variant to METIS to prevent pervasive warning (#4…
clevelam Dec 4, 2024
2aaf50b
eigen: remove unnecessary dependency on fortran (#47866)
alalazo Dec 4, 2024
f82554a
stage.py: improve path to url (#47898)
haampie Dec 4, 2024
16fd77f
rust-bootstrap: fix zlib dependency (#47894)
haampie Dec 4, 2024
8ce1678
Revert "Disable use of import in CI tests"
greenc-FNAL Dec 4, 2024
14512a7
Merge remote-tracking branch 'upstream/develop' into maintenance/merg…
greenc-FNAL Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Deploy ${{ matrix.dockerfile[0] }}
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
context: dockerfiles/${{ matrix.dockerfile[0] }}
platforms: ${{ matrix.dockerfile[1] }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/valid-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
. .github/workflows/bin/setup_git.sh
- name: Run style tests
run: |
share/spack/qa/run-style-tests -s import
share/spack/qa/run-style-tests
audit:
uses: ./.github/workflows/audit.yaml
secrets: inherit
Expand Down
2 changes: 2 additions & 0 deletions etc/spack/defaults/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,8 @@ packages:
buildable: false
cray-mvapich2:
buildable: false
egl:
buildable: false
fujitsu-mpi:
buildable: false
hpcx-mpi:
Expand Down
8 changes: 8 additions & 0 deletions lib/spack/docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,7 @@ Required:
* Microsoft Visual Studio
* Python
* Git
* 7z

Optional:
* Intel Fortran (needed for some packages)
Expand Down Expand Up @@ -1391,6 +1392,13 @@ as the project providing Git support on Windows. This is additionally the recomm
for installing Git on Windows, a link to which can be found above. Spack requires the
utilities vendored by this project.

"""
7zip
"""

A tool for extracting ``.xz`` files is required for extracting source tarballs. The latest 7zip
can be located at https://sourceforge.net/projects/sevenzip/.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Step 2: Install and setup Spack
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python-levenshtein==0.26.1
docutils==0.21.2
pygments==2.18.0
urllib3==2.2.3
pytest==8.3.3
pytest==8.3.4
isort==5.13.2
black==24.10.0
flake8==7.1.1
Expand Down
36 changes: 20 additions & 16 deletions lib/spack/llnl/util/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Callable,
Deque,
Dict,
Generator,
Iterable,
List,
Match,
Expand Down Expand Up @@ -2772,22 +2773,6 @@ def prefixes(path):
return paths


@system_path_filter
def md5sum(file):
"""Compute the MD5 sum of a file.

Args:
file (str): file to be checksummed

Returns:
MD5 sum of the file's content
"""
md5 = hashlib.md5()
with open(file, "rb") as f:
md5.update(f.read())
return md5.digest()


@system_path_filter
def remove_directory_contents(dir):
"""Remove all contents of a directory."""
Expand Down Expand Up @@ -2838,6 +2823,25 @@ def temporary_dir(
remove_directory_contents(tmp_dir)


@contextmanager
def edit_in_place_through_temporary_file(file_path: str) -> Generator[str, None, None]:
"""Context manager for modifying ``file_path`` in place, preserving its inode and hardlinks,
for functions or external tools that do not support in-place editing. Notice that this function
is unsafe in that it works with paths instead of a file descriptors, but this is by design,
since we assume the call site will create a new inode at the same path."""
tmp_fd, tmp_path = tempfile.mkstemp(
dir=os.path.dirname(file_path), prefix=f"{os.path.basename(file_path)}."
)
# windows cannot replace a file with open fds, so close since the call site needs to replace.
os.close(tmp_fd)
try:
shutil.copyfile(file_path, tmp_path, follow_symlinks=True)
yield tmp_path
shutil.copyfile(tmp_path, file_path, follow_symlinks=True)
finally:
os.unlink(tmp_path)


def filesummary(path, print_bytes=16) -> Tuple[int, bytes]:
"""Create a small summary of the given file. Does not error
when file does not exist.
Expand Down
4 changes: 3 additions & 1 deletion lib/spack/spack/binary_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2334,7 +2334,9 @@ def is_backup_file(file):
if not codesign:
return
for binary in changed_files:
codesign("-fs-", binary)
# preserve the original inode by running codesign on a copy
with fsys.edit_in_place_through_temporary_file(binary) as tmp_binary:
codesign("-fs-", tmp_binary)

# If we are installing back to the same location
# relocate the sbang location if the spack directory changed
Expand Down
22 changes: 13 additions & 9 deletions lib/spack/spack/build_systems/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re
import sys
from itertools import chain
from typing import Any, List, Optional, Set, Tuple
from typing import Any, List, Optional, Tuple

import archspec.cpu

Expand All @@ -23,6 +23,7 @@
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from spack import traverse
from spack.directives import build_system, conflicts, depends_on, variant
from spack.multimethod import when
from spack.util.environment import filter_system_paths
Expand Down Expand Up @@ -168,15 +169,18 @@ def _values(x):
def get_cmake_prefix_path(pkg: spack.package_base.PackageBase) -> List[str]:
"""Obtain the CMAKE_PREFIX_PATH entries for a package, based on the cmake_prefix_path package
attribute of direct build/test and transitive link dependencies."""
# Add direct build/test deps
selected: Set[str] = {s.dag_hash() for s in pkg.spec.dependencies(deptype=dt.BUILD | dt.TEST)}
# Add transitive link deps
selected.update(s.dag_hash() for s in pkg.spec.traverse(root=False, deptype=dt.LINK))
# Separate out externals so they do not shadow Spack prefixes
externals, spack_built = stable_partition(
(s for s in pkg.spec.traverse(root=False, order="topo") if s.dag_hash() in selected),
lambda x: x.external,
edges = traverse.traverse_topo_edges_generator(
traverse.with_artificial_edges([pkg.spec]),
visitor=traverse.MixedDepthVisitor(
direct=dt.BUILD | dt.TEST, transitive=dt.LINK, key=traverse.by_dag_hash
),
key=traverse.by_dag_hash,
root=False,
all_edges=False, # cover all nodes, not all edges
)
ordered_specs = [edge.spec for edge in edges]
# Separate out externals so they do not shadow Spack prefixes
externals, spack_built = stable_partition((s for s in ordered_specs), lambda x: x.external)

return filter_system_paths(
path for spec in chain(spack_built, externals) for path in spec.package.cmake_prefix_paths
Expand Down
2 changes: 0 additions & 2 deletions lib/spack/spack/cmd/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ def process_files(file_list, is_args):
rewrite_and_print_output(output, args, pat, replacement)

packages_isort_args = (
"--rm",
"spack",
"--rm",
"spack.pkgkit",
"--rm",
Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/compilers/intel.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def setup_custom_environment(self, pkg, env):
# Edge cases for Intel's oneAPI compilers when using the legacy classic compilers:
# Always pass flags to disable deprecation warnings, since these warnings can
# confuse tools that parse the output of compiler commands (e.g. version checks).
if self.real_version >= Version("2021") and self.real_version <= Version("2023"):
if self.real_version >= Version("2021") and self.real_version < Version("2024"):
env.append_flags("SPACK_ALWAYS_CFLAGS", "-diag-disable=10441")
env.append_flags("SPACK_ALWAYS_CXXFLAGS", "-diag-disable=10441")
if self.real_version >= Version("2021") and self.real_version <= Version("2024"):
if self.real_version >= Version("2021") and self.real_version < Version("2025"):
env.append_flags("SPACK_ALWAYS_FFLAGS", "-diag-disable=10448")
4 changes: 2 additions & 2 deletions lib/spack/spack/compilers/oneapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ def setup_custom_environment(self, pkg, env):
# icx+icpx+ifx or icx+icpx+ifort. But to be on the safe side (some users may
# want to try to swap icpx against icpc, for example), and since the Intel LLVM
# compilers accept these diag-disable flags, we apply them for all compilers.
if self.real_version >= Version("2021") and self.real_version <= Version("2023"):
if self.real_version >= Version("2021") and self.real_version < Version("2024"):
env.append_flags("SPACK_ALWAYS_CFLAGS", "-diag-disable=10441")
env.append_flags("SPACK_ALWAYS_CXXFLAGS", "-diag-disable=10441")
if self.real_version >= Version("2021") and self.real_version <= Version("2024"):
if self.real_version >= Version("2021") and self.real_version < Version("2025"):
env.append_flags("SPACK_ALWAYS_FFLAGS", "-diag-disable=10448")

# 2024 release bumped the libsycl version because of an ABI
Expand Down
11 changes: 6 additions & 5 deletions lib/spack/spack/relocate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import macholib.mach_o
import macholib.MachO

import llnl.util.filesystem as fs
import llnl.util.lang
import llnl.util.tty as tty
from llnl.util.lang import memoized
Expand Down Expand Up @@ -275,10 +276,10 @@ def modify_macho_object(cur_path, rpaths, deps, idpath, paths_to_paths):

# Deduplicate and flatten
args = list(itertools.chain.from_iterable(llnl.util.lang.dedupe(args)))
install_name_tool = executable.Executable("install_name_tool")
if args:
args.append(str(cur_path))
install_name_tool = executable.Executable("install_name_tool")
install_name_tool(*args)
with fs.edit_in_place_through_temporary_file(cur_path) as temp_path:
install_name_tool(*args, temp_path)


def macholib_get_paths(cur_path):
Expand Down Expand Up @@ -717,8 +718,8 @@ def fixup_macos_rpath(root, filename):
# No fixes needed
return False

args.append(abspath)
executable.Executable("install_name_tool")(*args)
with fs.edit_in_place_through_temporary_file(abspath) as temp_path:
executable.Executable("install_name_tool")(*args, temp_path)
return True


Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/schema/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@
{
"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.25.",
"Spack v0.23, and is currently ignored. It will be removed from config after "
"Spack v1.0.",
"error": False,
},
],
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/spack/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def _generate_fetchers(self, mirror_only=False) -> Generator["fs.FetchStrategy",
# Insert fetchers in the order that the URLs are provided.
fetchers[:0] = (
fs.from_url_scheme(
url_util.join(mirror.fetch_url, self.mirror_layout.path),
url_util.join(mirror.fetch_url, *self.mirror_layout.path.split(os.sep)),
checksum=digest,
expand=expand,
extension=extension,
Expand Down
11 changes: 11 additions & 0 deletions lib/spack/spack/test/llnl/util/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,3 +1249,14 @@ def test_find_input_types(tmp_path: pathlib.Path):

with pytest.raises(TypeError):
fs.find(1, "file.txt") # type: ignore


def test_edit_in_place_through_temporary_file(tmp_path):
(tmp_path / "example.txt").write_text("Hello")
current_ino = os.stat(tmp_path / "example.txt").st_ino
with fs.edit_in_place_through_temporary_file(tmp_path / "example.txt") as temporary:
os.unlink(temporary)
with open(temporary, "w") as f:
f.write("World")
assert (tmp_path / "example.txt").read_text() == "World"
assert os.stat(tmp_path / "example.txt").st_ino == current_ino
63 changes: 60 additions & 3 deletions lib/spack/spack/test/traverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ def create_dag(nodes, edges):
"""
specs = {name: Spec(name) for name in nodes}
for parent, child, deptypes in edges:
specs[parent].add_dependency_edge(
specs[child], depflag=dt.canonicalize(deptypes), virtuals=()
)
depflag = deptypes if isinstance(deptypes, dt.DepFlag) else dt.canonicalize(deptypes)
specs[parent].add_dependency_edge(specs[child], depflag=depflag, virtuals=())
return specs


Expand Down Expand Up @@ -454,3 +453,61 @@ def test_topo_is_bfs_for_trees(cover):
assert list(traverse.traverse_nodes([binary_tree["A"]], order="topo", cover=cover)) == list(
traverse.traverse_nodes([binary_tree["A"]], order="breadth", cover=cover)
)


@pytest.mark.parametrize("roots", [["A"], ["A", "B"], ["B", "A"], ["A", "B", "A"]])
@pytest.mark.parametrize("order", ["breadth", "post", "pre"])
@pytest.mark.parametrize("include_root", [True, False])
def test_mixed_depth_visitor(roots, order, include_root):
"""Test that the MixedDepthVisitor lists unique edges that are reachable either directly from
roots through build type edges, or transitively through link type edges. The tests ensures that
unique edges are listed exactly once."""
my_graph = create_dag(
nodes=["A", "B", "C", "D", "E", "F", "G", "H", "I"],
edges=(
("A", "B", dt.LINK | dt.RUN),
("A", "C", dt.BUILD),
("A", "D", dt.BUILD | dt.RUN),
("A", "H", dt.LINK),
("A", "I", dt.RUN),
("B", "D", dt.BUILD | dt.LINK),
("C", "E", dt.BUILD | dt.LINK | dt.RUN),
("D", "F", dt.LINK),
("D", "G", dt.BUILD | dt.RUN),
("H", "B", dt.LINK),
),
)
starting_points = traverse.with_artificial_edges([my_graph[root] for root in roots])
visitor = traverse.MixedDepthVisitor(direct=dt.BUILD, transitive=dt.LINK)

if order == "pre":
edges = traverse.traverse_depth_first_edges_generator(
starting_points, visitor, post_order=False, root=include_root
)
elif order == "post":
edges = traverse.traverse_depth_first_edges_generator(
starting_points, visitor, post_order=True, root=include_root
)
elif order == "breadth":
edges = traverse.traverse_breadth_first_edges_generator(
starting_points, visitor, root=include_root
)

artificial_edges = [(None, root) for root in roots] if include_root else []
simple_edges = [
(None if edge.parent is None else edge.parent.name, edge.spec.name) for edge in edges
]

# make sure that every edge is listed exactly once and that the right edges are listed
assert len(simple_edges) == len(set(simple_edges))
assert set(simple_edges) == {
# the roots
*artificial_edges,
("A", "B"),
("A", "C"),
("A", "D"),
("A", "H"),
("B", "D"),
("D", "F"),
("H", "B"),
}
3 changes: 3 additions & 0 deletions lib/spack/spack/test/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ def test_stringify_version(version_str):
v.string = None
assert str(v) == version_str

v.string = None
assert v.string == version_str


def test_len():
a = Version("1.2.3.4")
Expand Down
Loading
Loading