forked from spack/spack-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripting.sh
More file actions
executable file
·58 lines (40 loc) · 1.74 KB
/
scripting.sh
File metadata and controls
executable file
·58 lines (40 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Source definitions
project="$(dirname "$0")"
. "$project/defs.sh"
rm -rf "${raw_outputs:?}/scripting"
. "$project/init_spack.sh"
. share/spack/setup-env.sh
# spack install gcc@12
# spack compiler find "$(spack location -i gcc@12)"
# example scripting/setup "spack uninstall -ay"
# example scripting/setup "spack compiler rm gcc@12"
# example scripting/setup "spack install hdf5"
# example scripting/setup "spack install zlib%clang"
example scripting/find-format 'spack find --format "{name} {version} {hash:10}"'
example scripting/find-json "spack find --json zlib-ng"
printf "exit()\n" | example scripting/spack-python-1 "spack python"
fake_example scripting/edit '$EDITOR find_exclude.py' "/bin/true"
cat <<EOF | tee "$PROJECT/raw/0.find_exclude.py.example" find_exclude.py
from spack.spec import Spec
import spack.store
import spack.cmd
import sys
database = spack.store.STORE.db
include_spec = Spec(sys.argv[1])
exclude_spec = Spec(sys.argv[2])
all_included = database.query(include_spec)
result = [spec for spec in all_included if not spec.satisfies(exclude_spec)]
spack.cmd.display_specs(result)
EOF
example scripting/find-exclude-1 "spack python find_exclude.py %gcc ^mpich"
EXAMPLE1="$PROJECT/raw/1.find_exclude.py.example"
echo "#!/usr/bin/env spack python" > "$EXAMPLE1"
cat find_exclude.py >> "$EXAMPLE1"
cp "$EXAMPLE1" find_exclude.py
example scripting/find-exclude-2 "chmod u+x find_exclude.py"
example --expect-error scripting/find-exclude-2 "./find_exclude.py %gcc ^mpich"
EXAMPLE2="$PROJECT/raw/2.find_exclude.py.example"
sed s'|spack python|spack-python|' find_exclude.py > "$EXAMPLE2"
cp "$EXAMPLE2" find_exclude.py
example scripting/find-exclude-3 "./find_exclude.py %gcc ^mpich"