summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-01-17 14:14:45 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2018-01-17 14:14:45 -0800
commitc2a10a2aa23f3905ee22bb4b7c79ab963d966a9d (patch)
tree18d502edbbc09b8f9cf255697bd135e9718fb584 /share
parent52a9e5d2a31b4a66ce51d0ff03ab709417dee6dc (diff)
parentba6c39310b537bbeafd4eb00836623ac2bb19d99 (diff)
downloadspack-c2a10a2aa23f3905ee22bb4b7c79ab963d966a9d.tar.gz
spack-c2a10a2aa23f3905ee22bb4b7c79ab963d966a9d.tar.bz2
spack-c2a10a2aa23f3905ee22bb4b7c79ab963d966a9d.tar.xz
spack-c2a10a2aa23f3905ee22bb4b7c79ab963d966a9d.zip
Merge branch 'releases/v0.11.0'v0.11.0
Diffstat (limited to 'share')
-rw-r--r--share/spack/docs/docker/module-file-tutorial/Dockerfile52
-rw-r--r--share/spack/docs/docker/module-file-tutorial/packages.yaml9
-rw-r--r--share/spack/docs/docker/module-file-tutorial/spack.sh8
-rw-r--r--share/spack/logo/spack-logo-text-64.pngbin18644 -> 0 bytes
-rw-r--r--share/spack/logo/spack-logo-text-bottom.svg66
-rw-r--r--share/spack/logo/spack-logo-text.svg64
-rw-r--r--share/spack/logo/spack-logo-white-text-48.pngbin12201 -> 0 bytes
-rw-r--r--share/spack/logo/spack-logo-white-text-bottom.svg66
-rw-r--r--share/spack/logo/spack-logo-white-text.svg64
-rw-r--r--share/spack/logo/spack-logo-white.svg61
-rw-r--r--share/spack/logo/spack-logo.svg61
-rwxr-xr-xshare/spack/qa/check_dependencies96
-rw-r--r--share/spack/qa/configuration/packages.yaml13
-rwxr-xr-xshare/spack/qa/run-build-tests29
-rwxr-xr-xshare/spack/qa/run-doc-tests31
-rwxr-xr-xshare/spack/qa/run-flake8-tests23
-rwxr-xr-xshare/spack/qa/run-unit-tests45
-rwxr-xr-xshare/spack/qa/setup.sh118
-rwxr-xr-xshare/spack/setup-env.csh18
-rwxr-xr-xshare/spack/setup-env.sh64
-rwxr-xr-xshare/spack/spack-completion.bash953
21 files changed, 1657 insertions, 184 deletions
diff --git a/share/spack/docs/docker/module-file-tutorial/Dockerfile b/share/spack/docs/docker/module-file-tutorial/Dockerfile
new file mode 100644
index 0000000000..a012492a98
--- /dev/null
+++ b/share/spack/docs/docker/module-file-tutorial/Dockerfile
@@ -0,0 +1,52 @@
+FROM ubuntu:16.04
+
+# General environment for docker
+ENV DEBIAN_FRONTEND=noninteractive \
+ SPACK_ROOT=/usr/local \
+ FORCE_UNSAFE_CONFIGURE=1
+
+# Install system packages
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ autoconf \
+ build-essential \
+ ca-certificates \
+ coreutils \
+ curl man less \
+ emacs-nox vim nano \
+ git \
+ openmpi-bin openmpi-common libopenmpi-dev \
+ python \
+ unzip \
+ && rm -rf /var/lib/apt/lists/*
+
+# Load spack environment on login
+COPY spack.sh /etc/profile
+
+# Install spack
+RUN curl -s -L https://api.github.com/repos/spack/spack/tarball/develop \
+ | tar xzC $SPACK_ROOT --strip 1
+
+# Copy configuration for external packages
+COPY packages.yaml $SPACK_ROOT/etc/spack/
+
+# Build lmod
+RUN spack install lmod && spack clean -a
+
+# Build a compiler
+RUN spack install gcc@7.2.0 && spack clean -a
+RUN /bin/bash -l -c ' \
+ spack load gcc@7.2.0 \
+ && spack compiler add'
+
+# Build the software on top of the compiler
+RUN spack install netlib-scalapack ^openmpi ^openblas %gcc@7.2.0 \
+ && spack install netlib-scalapack ^mpich ^openblas %gcc@7.2.0 \
+ && spack install netlib-scalapack ^openmpi ^netlib-lapack %gcc@7.2.0 \
+ && spack install netlib-scalapack ^mpich ^netlib-lapack %gcc@7.2.0 \
+ && spack install py-scipy ^openblas \
+ && spack clean -a
+
+# image run hook: the -l will make sure /etc/profile environments are loaded
+CMD /bin/bash -l
+
diff --git a/share/spack/docs/docker/module-file-tutorial/packages.yaml b/share/spack/docs/docker/module-file-tutorial/packages.yaml
new file mode 100644
index 0000000000..8e3971e61f
--- /dev/null
+++ b/share/spack/docs/docker/module-file-tutorial/packages.yaml
@@ -0,0 +1,9 @@
+packages:
+ git:
+ buildable: False
+ paths:
+ git@2.9.4: /usr
+ openmpi:
+ buildable: False
+ paths:
+ openmpi@1.10.2: /usr
diff --git a/share/spack/docs/docker/module-file-tutorial/spack.sh b/share/spack/docs/docker/module-file-tutorial/spack.sh
new file mode 100644
index 0000000000..54d095c717
--- /dev/null
+++ b/share/spack/docs/docker/module-file-tutorial/spack.sh
@@ -0,0 +1,8 @@
+source $SPACK_ROOT/share/spack/setup-env.sh
+
+LMOD_DIR=$(spack location -i lmod)
+
+if [[ $LMOD_DIR ]] ; then
+ source ${LMOD_DIR}/lmod/lmod/init/bash
+ source $SPACK_ROOT/share/spack/setup-env.sh
+fi
diff --git a/share/spack/logo/spack-logo-text-64.png b/share/spack/logo/spack-logo-text-64.png
deleted file mode 100644
index 8dad4c519f..0000000000
--- a/share/spack/logo/spack-logo-text-64.png
+++ /dev/null
Binary files differ
diff --git a/share/spack/logo/spack-logo-text-bottom.svg b/share/spack/logo/spack-logo-text-bottom.svg
new file mode 100644
index 0000000000..90f5c5515e
--- /dev/null
+++ b/share/spack/logo/spack-logo-text-bottom.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="256" height="340"
+ viewBox="-128 -128 256 340"
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events">
+
+ <style>
+ .logo { font-family:Arial; font-weight:bold; }
+ .diamond { fill:#0f3a80; }
+ circle.back { fill:#ffa600; stroke:#0f3a80; stroke-width:6; }
+ circle.front { fill:#ffffff; stroke:#0f3a80; stroke-width:6; }
+ line.back { stroke:#ffa600; stroke-width:7; }
+ line.front { stroke:#ffffff; stroke-width:7; }
+ line.shadow { stroke:#0f3a80; stroke-width:7; }
+ </style>
+
+ <defs>
+ <!-- need two arrows b/c we can't sync color with the marked element -->
+ <marker id="barrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffa600"/>
+ </marker>
+ <marker id="farrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffffff"/>
+ </marker>
+ </defs>
+
+ <!-- rounded diamond shape -->
+ <rect x="-97" y="-97" width="194" height="194" rx="26" ry="26"
+ transform="rotate(45)" class="diamond"/>
+
+ <!-- background dependency structure -->
+ <line x1="-11" y1="-80" x2="-11" y2="-29" transform="rotate(42 -11 -80)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-80" y1="0" x2="-80" y2="57" transform="rotate(-45 -80 0)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-11" y1="-80" x2="-11" y2="28" class="back"
+ marker-end="url(#barrow)"/>
+
+ <circle cx="-11" cy="-80" r="23" class="back"/>
+ <circle cx="0" cy="80" r="23" class="back"/>
+ <circle cx="-80" cy="0" r="23" class="back"/>
+
+ <!-- foreground dependency structure -->
+ <line x1="18" y1="-80" x2="18" y2="0" transform="rotate(42 17 -80)"
+ class="shadow"/>
+ <line x1="13" y1="-80" x2="13" y2="-5" transform="rotate(42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+
+ <line x1="11" y1="-80" x2="11" y2="-29" transform="rotate(-42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="80" y1="0" x2="80" y2="57" transform="rotate(45 80 0)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="11" y1="-80" x2="11" y2="28" class="front"
+ marker-end="url(#farrow)"/>
+
+ <circle cx="11" cy="-80" r="23" class="front"/>
+ <circle cx="80" cy="0" r="23" class="front"/>
+
+ <text x="0" y="184" text-anchor="middle" font-size="64pt" class="logo">
+ Spack
+ </text>
+</svg>
diff --git a/share/spack/logo/spack-logo-text.svg b/share/spack/logo/spack-logo-text.svg
new file mode 100644
index 0000000000..5ad4588d8a
--- /dev/null
+++ b/share/spack/logo/spack-logo-text.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="850" height="256"
+ viewBox="-128 -128 850 256"
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events">
+
+ <style>
+ .logo { font-family:Arial; font-weight:bold; }
+ .diamond { fill:#0f3a80; }
+ circle.back { fill:#ffa600; stroke:#0f3a80; stroke-width:6; }
+ circle.front { fill:#ffffff; stroke:#0f3a80; stroke-width:6; }
+ line.back { stroke:#ffa600; stroke-width:7; }
+ line.front { stroke:#ffffff; stroke-width:7; }
+ line.shadow { stroke:#0f3a80; stroke-width:7; }
+ </style>
+
+ <defs>
+ <!-- need two arrows b/c we can't sync color with the marked element -->
+ <marker id="barrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffa600"/>
+ </marker>
+ <marker id="farrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffffff"/>
+ </marker>
+ </defs>
+
+ <!-- rounded diamond shape -->
+ <rect x="-97" y="-97" width="194" height="194" rx="26" ry="26"
+ transform="rotate(45)" class="diamond"/>
+
+ <!-- background dependency structure -->
+ <line x1="-11" y1="-80" x2="-11" y2="-29" transform="rotate(42 -11 -80)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-80" y1="0" x2="-80" y2="57" transform="rotate(-45 -80 0)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-11" y1="-80" x2="-11" y2="28" class="back"
+ marker-end="url(#barrow)"/>
+
+ <circle cx="-11" cy="-80" r="23" class="back"/>
+ <circle cx="0" cy="80" r="23" class="back"/>
+ <circle cx="-80" cy="0" r="23" class="back"/>
+
+ <!-- foreground dependency structure -->
+ <line x1="18" y1="-80" x2="18" y2="0" transform="rotate(42 17 -80)"
+ class="shadow"/>
+ <line x1="13" y1="-80" x2="13" y2="-5" transform="rotate(42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+
+ <line x1="11" y1="-80" x2="11" y2="-29" transform="rotate(-42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="80" y1="0" x2="80" y2="57" transform="rotate(45 80 0)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="11" y1="-80" x2="11" y2="28" class="front"
+ marker-end="url(#farrow)"/>
+
+ <circle cx="11" cy="-80" r="23" class="front"/>
+ <circle cx="80" cy="0" r="23" class="front"/>
+
+ <text x="160" y="64" font-size="128pt" class="logo">Spack</text>
+</svg>
diff --git a/share/spack/logo/spack-logo-white-text-48.png b/share/spack/logo/spack-logo-white-text-48.png
deleted file mode 100644
index 9e60867e81..0000000000
--- a/share/spack/logo/spack-logo-white-text-48.png
+++ /dev/null
Binary files differ
diff --git a/share/spack/logo/spack-logo-white-text-bottom.svg b/share/spack/logo/spack-logo-white-text-bottom.svg
new file mode 100644
index 0000000000..25d62a6b2d
--- /dev/null
+++ b/share/spack/logo/spack-logo-white-text-bottom.svg
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="256" height="340"
+ viewBox="-128 -128 256 340"
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events">
+
+ <style>
+ .logo { font-family:Arial; font-weight:bold; fill:#ffffff; }
+ .diamond { fill:#ffffff; }
+ circle.back { fill:#ffa600; stroke:#ffffff; stroke-width:6; }
+ circle.front { fill:#0e3d7e; stroke:#ffffff; stroke-width:6; }
+ line.back { stroke:#ffa600; stroke-width:7; }
+ line.front { stroke:#0e3d7e; stroke-width:7; }
+ line.shadow { stroke:#ffffff; stroke-width:7; }
+ </style>
+
+ <defs>
+ <!-- need two arrows b/c we can't sync color with the marked element -->
+ <marker id="barrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffa600"/>
+ </marker>
+ <marker id="farrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#0e3d7e"/>
+ </marker>
+ </defs>
+
+ <!-- rounded diamond shape -->
+ <rect x="-97" y="-97" width="194" height="194" rx="26" ry="26"
+ transform="rotate(45)" class="diamond"/>
+
+ <!-- background dependency structure -->
+ <line x1="-11" y1="-80" x2="-11" y2="-29" transform="rotate(42 -11 -80)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-80" y1="0" x2="-80" y2="57" transform="rotate(-45 -80 0)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-11" y1="-80" x2="-11" y2="28" class="back"
+ marker-end="url(#barrow)"/>
+
+ <circle cx="-11" cy="-80" r="23" class="back"/>
+ <circle cx="0" cy="80" r="23" class="back"/>
+ <circle cx="-80" cy="0" r="23" class="back"/>
+
+ <!-- foreground dependency structure -->
+ <line x1="18" y1="-80" x2="18" y2="0" transform="rotate(42 17 -80)"
+ class="shadow"/>
+ <line x1="13" y1="-80" x2="13" y2="-5" transform="rotate(42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+
+ <line x1="11" y1="-80" x2="11" y2="-29" transform="rotate(-42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="80" y1="0" x2="80" y2="57" transform="rotate(45 80 0)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="11" y1="-80" x2="11" y2="28" class="front"
+ marker-end="url(#farrow)"/>
+
+ <circle cx="11" cy="-80" r="23" class="front"/>
+ <circle cx="80" cy="0" r="23" class="front"/>
+
+ <text x="0" y="184" text-anchor="middle" font-size="64pt" class="logo">
+ Spack
+ </text>
+</svg>
diff --git a/share/spack/logo/spack-logo-white-text.svg b/share/spack/logo/spack-logo-white-text.svg
new file mode 100644
index 0000000000..d3dfd73f5c
--- /dev/null
+++ b/share/spack/logo/spack-logo-white-text.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="850" height="256"
+ viewBox="-128 -128 850 256"
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events">
+
+ <style>
+ .logo { font-family:Arial; font-weight:bold; fill:#ffffff; }
+ .diamond { fill:#ffffff; }
+ circle.back { fill:#ffa600; stroke:#ffffff; stroke-width:6; }
+ circle.front { fill:#0e3d7e; stroke:#ffffff; stroke-width:6; }
+ line.back { stroke:#ffa600; stroke-width:7; }
+ line.front { stroke:#0e3d7e; stroke-width:7; }
+ line.shadow { stroke:#ffffff; stroke-width:7; }
+ </style>
+
+ <defs>
+ <!-- need two arrows b/c we can't sync color with the marked element -->
+ <marker id="barrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffa600"/>
+ </marker>
+ <marker id="farrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#0e3d7e"/>
+ </marker>
+ </defs>
+
+ <!-- rounded diamond shape -->
+ <rect x="-97" y="-97" width="194" height="194" rx="26" ry="26"
+ transform="rotate(45)" class="diamond"/>
+
+ <!-- background dependency structure -->
+ <line x1="-11" y1="-80" x2="-11" y2="-29" transform="rotate(42 -11 -80)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-80" y1="0" x2="-80" y2="57" transform="rotate(-45 -80 0)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-11" y1="-80" x2="-11" y2="28" class="back"
+ marker-end="url(#barrow)"/>
+
+ <circle cx="-11" cy="-80" r="23" class="back"/>
+ <circle cx="0" cy="80" r="23" class="back"/>
+ <circle cx="-80" cy="0" r="23" class="back"/>
+
+ <!-- foreground dependency structure -->
+ <line x1="18" y1="-80" x2="18" y2="0" transform="rotate(42 17 -80)"
+ class="shadow"/>
+ <line x1="13" y1="-80" x2="13" y2="-5" transform="rotate(42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+
+ <line x1="11" y1="-80" x2="11" y2="-29" transform="rotate(-42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="80" y1="0" x2="80" y2="57" transform="rotate(45 80 0)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="11" y1="-80" x2="11" y2="28" class="front"
+ marker-end="url(#farrow)"/>
+
+ <circle cx="11" cy="-80" r="23" class="front"/>
+ <circle cx="80" cy="0" r="23" class="front"/>
+
+ <text x="160" y="64" font-size="128pt" class="logo">Spack</text>
+</svg>
diff --git a/share/spack/logo/spack-logo-white.svg b/share/spack/logo/spack-logo-white.svg
new file mode 100644
index 0000000000..3e6c40d123
--- /dev/null
+++ b/share/spack/logo/spack-logo-white.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="256" height="256"
+ viewBox="-128 -128 256 256"
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events">
+
+ <style>
+ .diamond { fill:#ffffff; }
+ circle.back { fill:#ffa600; stroke:#ffffff; stroke-width:6; }
+ circle.front { fill:#0e3d7e; stroke:#ffffff; stroke-width:6; }
+ line.back { stroke:#ffa600; stroke-width:7; }
+ line.front { stroke:#0e3d7e; stroke-width:7; }
+ line.shadow { stroke:#ffffff; stroke-width:7; }
+ </style>
+
+ <defs>
+ <!-- need two arrows b/c we can't sync color with the marked element -->
+ <marker id="barrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffa600"/>
+ </marker>
+ <marker id="farrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#0e3d7e"/>
+ </marker>
+ </defs>
+
+ <!-- rounded diamond shape -->
+ <rect x="-97" y="-97" width="194" height="194" rx="26" ry="26"
+ transform="rotate(45)" class="diamond"/>
+
+ <!-- background dependency structure -->
+ <line x1="-11" y1="-80" x2="-11" y2="-29" transform="rotate(42 -11 -80)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-80" y1="0" x2="-80" y2="57" transform="rotate(-45 -80 0)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-11" y1="-80" x2="-11" y2="28" class="back"
+ marker-end="url(#barrow)"/>
+
+ <circle cx="-11" cy="-80" r="23" class="back"/>
+ <circle cx="0" cy="80" r="23" class="back"/>
+ <circle cx="-80" cy="0" r="23" class="back"/>
+
+ <!-- foreground dependency structure -->
+ <line x1="18" y1="-80" x2="18" y2="0" transform="rotate(42 17 -80)"
+ class="shadow"/>
+ <line x1="13" y1="-80" x2="13" y2="-5" transform="rotate(42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+
+ <line x1="11" y1="-80" x2="11" y2="-29" transform="rotate(-42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="80" y1="0" x2="80" y2="57" transform="rotate(45 80 0)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="11" y1="-80" x2="11" y2="28" class="front"
+ marker-end="url(#farrow)"/>
+
+ <circle cx="11" cy="-80" r="23" class="front"/>
+ <circle cx="80" cy="0" r="23" class="front"/>
+</svg>
diff --git a/share/spack/logo/spack-logo.svg b/share/spack/logo/spack-logo.svg
new file mode 100644
index 0000000000..a56eed57a6
--- /dev/null
+++ b/share/spack/logo/spack-logo.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="256" height="256"
+ viewBox="-128 -128 256 256"
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events">
+
+ <style>
+ .diamond { fill:#0f3a80; }
+ circle.back { fill:#ffa600; stroke:#0f3a80; stroke-width:6; }
+ circle.front { fill:#ffffff; stroke:#0f3a80; stroke-width:6; }
+ line.back { stroke:#ffa600; stroke-width:7; }
+ line.front { stroke:#ffffff; stroke-width:7; }
+ line.shadow { stroke:#0f3a80; stroke-width:7; }
+ </style>
+
+ <defs>
+ <!-- need two arrows b/c we can't sync color with the marked element -->
+ <marker id="barrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffa600"/>
+ </marker>
+ <marker id="farrow" markerWidth="4" markerHeight="3" refX=".05" refY="1.5"
+ orient="auto" markerUnits="strokeWidth">
+ <path d="M0,0 L0,3 L4,1.5 z" fill="#ffffff"/>
+ </marker>
+ </defs>
+
+ <!-- rounded diamond shape -->
+ <rect x="-97" y="-97" width="194" height="194" rx="26" ry="26"
+ transform="rotate(45)" class="diamond"/>
+
+ <!-- background dependency structure -->
+ <line x1="-11" y1="-80" x2="-11" y2="-29" transform="rotate(42 -11 -80)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-80" y1="0" x2="-80" y2="57" transform="rotate(-45 -80 0)"
+ class="back" marker-end="url(#barrow)"/>
+ <line x1="-11" y1="-80" x2="-11" y2="28" class="back"
+ marker-end="url(#barrow)"/>
+
+ <circle cx="-11" cy="-80" r="23" class="back"/>
+ <circle cx="0" cy="80" r="23" class="back"/>
+ <circle cx="-80" cy="0" r="23" class="back"/>
+
+ <!-- foreground dependency structure -->
+ <line x1="18" y1="-80" x2="18" y2="0" transform="rotate(42 17 -80)"
+ class="shadow"/>
+ <line x1="13" y1="-80" x2="13" y2="-5" transform="rotate(42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+
+ <line x1="11" y1="-80" x2="11" y2="-29" transform="rotate(-42 11 -80)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="80" y1="0" x2="80" y2="57" transform="rotate(45 80 0)"
+ class="front" marker-end="url(#farrow)"/>
+ <line x1="11" y1="-80" x2="11" y2="28" class="front"
+ marker-end="url(#farrow)"/>
+
+ <circle cx="11" cy="-80" r="23" class="front"/>
+ <circle cx="80" cy="0" r="23" class="front"/>
+</svg>
diff --git a/share/spack/qa/check_dependencies b/share/spack/qa/check_dependencies
deleted file mode 100755
index e999463b03..0000000000
--- a/share/spack/qa/check_dependencies
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env bash
-#
-# Description:
-# Check to see if dependencies are installed.
-# If not, warn the user and tell them how to
-# install these dependencies.
-#
-# Usage:
-# check-deps <dep> ...
-#
-# Options:
-# One or more dependencies. Must use name of binary.
-
-for dep in "$@"; do
- if ! which $dep &> /dev/null; then
- # Map binary name to package name
- case $dep in
- sphinx-apidoc|sphinx-build)
- spack_package=py-sphinx
- pip_package=sphinx
- ;;
- coverage)
- spack_package=py-coverage
- pip_package=coverage
- ;;
- flake8)
- spack_package=py-flake8
- pip_package=flake8
- ;;
- dot)
- spack_package=graphviz
- ;;
- git)
- spack_package=git
- ;;
- hg)
- spack_package=mercurial
- pip_package=mercurial
- ;;
- svn)
- spack_package=subversion
- ;;
- *)
- spack_package=$dep
- pip_package=$dep
- ;;
- esac
-
- echo "ERROR: $dep is required to run this script."
- echo
-
- if [[ $spack_package ]]; then
- echo "To install with Spack, run:"
- echo " $ spack install $spack_package"
- fi
-
- if [[ $pip_package ]]; then
- echo "To install with pip, run:"
- echo " $ pip install $pip_package"
- fi
-
- if [[ $spack_package || $pip_package ]]; then
- echo "Then add the bin directory to your PATH."
- fi
-
- exit 1
- fi
-
- # Flake8 and Sphinx require setuptools in order to run.
- # Otherwise, they print out this error message:
- #
- # Traceback (most recent call last):
- # File: "/usr/bin/flake8", line 5, in <module>
- # from pkg_resources import load_entry_point
- # ImportError: No module named pkg_resources
- #
- # Print a more useful error message if setuptools not found.
- if [[ $dep == flake8 || $dep == sphinx* ]]; then
- # Find which Python is being run
- # Spack-installed packages have a hard-coded shebang
- python_cmd=$(head -n 1 $(which $dep) | cut -c 3-)
- # May not have a shebang
- if [[ $python_cmd != *python* ]]; then
- python_cmd=python
- fi
- # Check if setuptools is in the PYTHONPATH
- if ! $python_cmd -c "import setuptools" 2> /dev/null; then
- echo "ERROR: setuptools is required to run $dep."
- echo "Please add it to your PYTHONPATH."
-
- exit 1
- fi
- fi
-done
-
-echo "Dependencies found."
diff --git a/share/spack/qa/configuration/packages.yaml b/share/spack/qa/configuration/packages.yaml
new file mode 100644
index 0000000000..fad3489d3b
--- /dev/null
+++ b/share/spack/qa/configuration/packages.yaml
@@ -0,0 +1,13 @@
+packages:
+ cmake:
+ buildable: False
+ paths:
+ cmake@2.8.12.2: /usr
+ r:
+ buildable: False
+ paths:
+ r@3.0.2: /usr
+ perl:
+ buildable: False
+ paths:
+ perl@5.18.2: /usr
diff --git a/share/spack/qa/run-build-tests b/share/spack/qa/run-build-tests
new file mode 100755
index 0000000000..b5d5aed28f
--- /dev/null
+++ b/share/spack/qa/run-build-tests
@@ -0,0 +1,29 @@
+#!/bin/bash -e
+#
+# Description:
+# Runs Spack build smoke tests. This installs a few packages that
+# cover different parts of the build system. It is not an exhaustive
+# test of Spack's packages.
+#
+# Usage:
+# run-build-tests
+#
+. "$(dirname $0)/setup.sh"
+check_dependencies ${coverage} git hg svn
+
+# Move to root directory of Spack
+# Allows script to be run from anywhere
+cd "$SPACK_ROOT"
+
+# Make sure we have a spec to build.
+if [ -z "$SPEC" ]; then
+ echo "Error: run-build-tests requires the $SPEC to build to be set."
+ exit 1
+fi
+
+# Print compiler information
+spack config get compilers
+
+# Run some build smoke tests, potentially with code coverage
+${coverage_run} bin/spack install -v ${SPEC}
+${coverage_combine}
diff --git a/share/spack/qa/run-doc-tests b/share/spack/qa/run-doc-tests
index ca892d7eb4..c43779fcaf 100755
--- a/share/spack/qa/run-doc-tests
+++ b/share/spack/qa/run-doc-tests
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash -e
#
# Description:
# Builds Spack documentation and checks for
@@ -8,34 +8,13 @@
# Usage:
# run-doc-tests
#
-# Notes:
-# Requires sphinx, graphviz, git, mercurial, and subversion.
-#
-
-QA_DIR="$(dirname "$0")"
-SPACK_ROOT="$QA_DIR/../../.."
-DOC_DIR="$SPACK_ROOT/lib/spack/docs"
-
-# Array of dependencies
-deps=(
- sphinx-apidoc
- sphinx-build
- dot
- git
- hg
- svn
-)
-
-# Check for dependencies
-"$QA_DIR/check_dependencies" "${deps[@]}" || exit 1
-
-# Add Spack to the PATH.
-export PATH="$SPACK_ROOT/bin:$PATH"
+. "$(dirname $0)/setup.sh"
+check_dependencies sphinx-apidoc sphinx-build dot git hg svn
# Move to documentation directory
# Allows script to be run from anywhere
-cd "$DOC_DIR"
+cd "$SPACK_ROOT/lib/spack/docs"
# Treat warnings as fatal errors
make clean --silent
-make SPHINXOPTS=-W JOBS=1
+make SPHINXOPTS=-W
diff --git a/share/spack/qa/run-flake8-tests b/share/spack/qa/run-flake8-tests
index 83469eeb9d..29fc15f9d7 100755
--- a/share/spack/qa/run-flake8-tests
+++ b/share/spack/qa/run-flake8-tests
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash -e
#
# Description:
# Runs source code style checks on Spack.
@@ -8,22 +8,7 @@
# Usage:
# run-flake8-tests
#
-# Notes:
-# Requires flake8.
-#
-
-QA_DIR="$(dirname "$0")"
-SPACK_ROOT="$QA_DIR/../../.."
-
-# Array of dependencies
-deps=(
- flake8
-)
-
-# Check for dependencies
-"$QA_DIR/check_dependencies" "${deps[@]}" || exit 1
-
-# Add Spack to the PATH.
-export PATH="$SPACK_ROOT/bin:$PATH"
+. "$(dirname $0)/setup.sh"
+check_dependencies flake8
-exec spack flake8
+spack flake8
diff --git a/share/spack/qa/run-unit-tests b/share/spack/qa/run-unit-tests
index d2ce9647af..87203ba915 100755
--- a/share/spack/qa/run-unit-tests
+++ b/share/spack/qa/run-unit-tests
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash -e
#
# Description:
# Runs Spack unit tests.
@@ -10,42 +10,23 @@
# Optionally add one or more unit tests
# to only run these tests.
#
-# Notes:
-# Requires coverage, git, mercurial, and subversion.
-#
-
-QA_DIR="$(dirname "$0")"
-SPACK_ROOT="$QA_DIR/../../.."
-
-# Array of dependencies
-deps=(
- coverage
- git
- hg
- svn
-)
-
-# Check for dependencies
-"$QA_DIR/check_dependencies" "${deps[@]}" || exit 1
-
-# Add Spack to the PATH.
-export PATH="$SPACK_ROOT/bin:$PATH"
+. "$(dirname $0)/setup.sh"
+check_dependencies ${coverage} git hg svn
# Move to root directory of Spack
# Allows script to be run from anywhere
cd "$SPACK_ROOT"
-# Run integration tests
-# TODO: should these be separated into a different test suite?
-source "$SPACK_ROOT/share/spack/setup-env.sh"
-spack compilers
+# Print compiler information
spack config get compilers
+# Run spack help to cover command import
+${coverage_run} bin/spack -h
+${coverage_run} bin/spack help -a
+
+# Profile and print top 20 lines for a simple call to spack spec
+${coverage_run} bin/spack -p --lines 20 spec mpileaks
+
# Run unit tests with code coverage
-if [[ "$TRAVIS_PYTHON_VERSION" == 2.7 ]]; then
- coverage run bin/spack install -v libdwarf
- coverage run bin/spack test "$@" && coverage combine
-else
- spack install -v libdwarf
- spack test "$@"
-fi
+${coverage_run} bin/spack test "$@"
+${coverage_combine}
diff --git a/share/spack/qa/setup.sh b/share/spack/qa/setup.sh
new file mode 100755
index 0000000000..98c79a0457
--- /dev/null
+++ b/share/spack/qa/setup.sh
@@ -0,0 +1,118 @@
+#!/bin/bash -e
+#
+# Description:
+# Common setup code to be sourced by Spack's test scripts.
+#
+
+QA_DIR="$(dirname ${BASH_SOURCE[0]})"
+SPACK_ROOT="$QA_DIR/../../.."
+
+# Source the setup script
+. "$SPACK_ROOT/share/spack/setup-env.sh"
+
+# Set up some variables for running coverage tests.
+if [[ "$COVERAGE" == true ]]; then
+ coverage=coverage
+ coverage_run="coverage run"
+ coverage_combine="coverage combine"
+else
+ coverage=""
+ coverage_run=""
+ coverage_combine=""
+fi
+
+#
+# Description:
+# Check to see if dependencies are installed.
+# If not, warn the user and tell them how to
+# install these dependencies.
+#
+# Usage:
+# check-deps <dep> ...
+#
+# Options:
+# One or more dependencies. Must use name of binary.
+check_dependencies() {
+ for dep in "$@"; do
+ if ! which $dep &> /dev/null; then
+ # Map binary name to package name
+ case $dep in
+ sphinx-apidoc|sphinx-build)
+ spack_package=py-sphinx
+ pip_package=sphinx
+ ;;
+ coverage)
+ spack_package=py-coverage
+ pip_package=coverage
+ ;;
+ flake8)
+ spack_package=py-flake8
+ pip_package=flake8
+ ;;
+ dot)
+ spack_package=graphviz
+ ;;
+ git)
+ spack_package=git
+ ;;
+ hg)
+ spack_package=mercurial
+ pip_package=mercurial
+ ;;
+ svn)
+ spack_package=subversion
+ ;;
+ *)
+ spack_package=$dep
+ pip_package=$dep
+ ;;
+ esac
+
+ echo "ERROR: $dep is required to run this script."
+ echo
+
+ if [[ $spack_package ]]; then
+ echo "To install with Spack, run:"
+ echo " $ spack install $spack_package"
+ fi
+
+ if [[ $pip_package ]]; then
+ echo "To install with pip, run:"
+ echo " $ pip install $pip_package"
+ fi
+
+ if [[ $spack_package || $pip_package ]]; then
+ echo "Then add the bin directory to your PATH."
+ fi
+
+ exit 1
+ fi
+
+ # Flake8 and Sphinx require setuptools in order to run.
+ # Otherwise, they print out this error message:
+ #
+ # Traceback (most recent call last):
+ # File: "/usr/bin/flake8", line 5, in <module>
+ # from pkg_resources import load_entry_point
+ # ImportError: No module named pkg_resources
+ #
+ # Print a more useful error message if setuptools not found.
+ if [[ $dep == flake8 || $dep == sphinx* ]]; then
+ # Find which Python is being run
+ # Spack-installed packages have a hard-coded shebang
+ python_cmd=$(head -n 1 $(which $dep) | cut -c 3-)
+ # May not have a shebang
+ if [[ $python_cmd != *python* ]]; then
+ python_cmd=python
+ fi
+ # Check if setuptools is in the PYTHONPATH
+ if ! $python_cmd -c "import setuptools" 2> /dev/null; then
+ echo "ERROR: setuptools is required to run $dep."
+ echo "Please add it to your PYTHONPATH."
+
+ exit 1
+ fi
+ fi
+ done
+ echo "Dependencies found."
+}
diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh
index b960c21459..6fc728daa8 100755
--- a/share/spack/setup-env.csh
+++ b/share/spack/setup-env.csh
@@ -1,13 +1,13 @@
##############################################################################
-# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
-# For details, see https://github.com/llnl/spack
-# Please also see the LICENSE file for our notice and the LGPL.
+# For details, see https://github.com/spack/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
@@ -39,9 +39,15 @@ if ($?SPACK_ROOT) then
alias spack 'set _sp_args = (\!*); source $_spack_share_dir/csh/spack.csh'
alias _spack_pathadd 'set _pa_args = (\!*) && source $_spack_share_dir/csh/pathadd.csh'
+ # Shamelessly stolen from setup-env.sh
+ set _sp_sys_type = `$SPACK_ROOT/bin/spack python -c 'print(spack.architecture.sys_type())'`
+ set _sp_dotkit_root = `$SPACK_ROOT/bin/spack python -c "print(spack.util.path.canonicalize_path(spack.config.get_config('config').get('module_roots').get('dotkit')))"`
+ set _sp_tcl_root = `$SPACK_ROOT/bin/spack python -c "print(spack.util.path.canonicalize_path(spack.config.get_config('config').get('module_roots').get('tcl')))"`
+
# Set up modules and dotkit search paths in the user environment
- # TODO: fix SYS_TYPE to something non-LLNL-specific
- _spack_pathadd DK_NODE "$_spack_share_dir/dotkit/$SYS_TYPE"
- _spack_pathadd MODULEPATH "$_spack_share_dir/modules/$SYS_TYPE"
+ _spack_pathadd DK_NODE "$_sp_dotkit_root/$_sp_sys_type"
+ _spack_pathadd MODULEPATH "$_sp_tcl_root/$_sp_sys_type"
_spack_pathadd PATH "$SPACK_ROOT/bin"
+else
+ echo "ERROR: Sourcing spack setup-env.csh requires setting SPACK_ROOT to the root of your spack installation"
endif
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 943db72612..21a7e00345 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -1,13 +1,13 @@
##############################################################################
-# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
-# For details, see https://github.com/llnl/spack
-# Please also see the LICENSE file for our notice and the LGPL.
+# For details, see https://github.com/spack/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
@@ -27,7 +27,9 @@
#
# This file is part of Spack and sets up the spack environment for
# bash and zsh. This includes dotkit support, module support, and
-# it also puts spack in your path. Source it like this:
+# it also puts spack in your path. The script also checks that
+# at least module support exists, and provides suggestions if it
+# doesn't. Source it like this:
#
# . /path/to/spack/share/spack/setup-env.sh
#
@@ -92,6 +94,8 @@ function spack {
LOC="$(spack location $_sp_arg "$@")"
if [[ -d "$LOC" ]] ; then
cd "$LOC"
+ else
+ return 1
fi
fi
return
@@ -167,6 +171,11 @@ function _spack_pathadd {
fi
}
+# Export spack function so it is available in subshells (only works with bash)
+if [ -n "${BASH_VERSION:-}" ]; then
+ export -f spack
+fi
+
#
# Figure out where this file is. Below code needs to be portable to
# bash and zsh.
@@ -182,14 +191,59 @@ if [ -z "$_sp_source_file" ]; then
fi
#
-# Set up modules and dotkit search paths in the user environment
+# Find root directory and add bin to path.
#
_sp_share_dir=$(cd "$(dirname $_sp_source_file)" && pwd)
_sp_prefix=$(cd "$(dirname $(dirname $_sp_share_dir))" && pwd)
_spack_pathadd PATH "${_sp_prefix%/}/bin"
+export SPACK_ROOT=${_sp_prefix}
+#
+# Determine which shell is being used
+#
+function _spack_determine_shell() {
+ ps -p $$ | tail -n 1 | awk '{print $4}' | sed 's/^-//' | xargs basename
+}
+export SPACK_SHELL=$(_spack_determine_shell)
+
+#
+# Check whether a function of the given name is defined
+#
+function _spack_fn_exists() {
+ LANG= type $1 2>&1 | grep -q 'function'
+}
+
+need_module="no"
+if ! _spack_fn_exists use && ! _spack_fn_exists module; then
+ need_module="yes"
+fi;
+
+#
+# build and make available environment-modules
+#
+if [ "${need_module}" = "yes" ]; then
+ #check if environment-modules is installed
+ module_prefix="$(spack location -i "environment-modules" 2>&1 || echo "not_installed")"
+ module_prefix=$(echo "${module_prefix}" | tail -n 1)
+ if [ "${module_prefix}" != "not_installed" ]; then
+ #activate it!
+ export MODULE_PREFIX=${module_prefix}
+ _spack_pathadd PATH "${MODULE_PREFIX}/Modules/bin"
+ module() { eval `${MODULE_PREFIX}/Modules/bin/modulecmd ${SPACK_SHELL} $*`; }
+ fi;
+fi;
+
+#
+# Set up modules and dotkit search paths in the user environment
+#
_sp_sys_type=$(spack-python -c 'print(spack.architecture.sys_type())')
_sp_dotkit_root=$(spack-python -c "print(spack.util.path.canonicalize_path(spack.config.get_config('config').get('module_roots', {}).get('dotkit')))")
_sp_tcl_root=$(spack-python -c "print(spack.util.path.canonicalize_path(spack.config.get_config('config').get('module_roots', {}).get('tcl')))")
_spack_pathadd DK_NODE "${_sp_dotkit_root%/}/$_sp_sys_type"
_spack_pathadd MODULEPATH "${_sp_tcl_root%/}/$_sp_sys_type"
+
+# Add programmable tab completion for Bash
+#
+if [ -n "${BASH_VERSION:-}" ]; then
+ source $_sp_share_dir/spack-completion.bash
+fi
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
new file mode 100755
index 0000000000..56cbfef792
--- /dev/null
+++ b/share/spack/spack-completion.bash
@@ -0,0 +1,953 @@
+##############################################################################
+# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/spack/spack
+# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+
+# The following global variables are used/set by Bash programmable completion
+# COMP_CWORD: An index into ${COMP_WORDS} of the word containing the
+# current cursor position
+# COMP_LINE: The current command line
+# COMP_WORDS: an array containing individual command arguments typed so far
+# COMPREPLY: an array containing possible completions as a result of your
+# function
+
+# Bash programmable completion for Spack
+function _bash_completion_spack {
+ # In all following examples, let the cursor be denoted by brackets, i.e. []
+
+ # For our purposes, flags should not affect tab completion. For instance,
+ # `spack install []` and `spack -d install --jobs 8 []` should both give the same
+ # possible completions. Therefore, we need to ignore any flags in COMP_WORDS.
+ local COMP_WORDS_NO_FLAGS=()
+ local index=0
+ while [[ "$index" -lt "$COMP_CWORD" ]]
+ do
+ if [[ "${COMP_WORDS[$index]}" == [a-z]* ]]
+ then
+ COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$index]}")
+ fi
+ let index++
+ done
+
+ # Options will be listed by a subfunction named after non-flag arguments.
+ # For example, `spack -d install []` will call _spack_install
+ # and `spack compiler add []` will call _spack_compiler_add
+ local subfunction=$(IFS='_'; echo "_${COMP_WORDS_NO_FLAGS[*]}")
+ # Translate dashes to underscores, as dashes are not permitted in
+ # compatibility mode. See https://github.com/spack/spack/pull/4079
+ subfunction=${subfunction//-/_}
+
+ # However, the word containing the current cursor position needs to be
+ # added regardless of whether or not it is a flag. This allows us to
+ # complete something like `spack install --keep-st[]`
+ COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$COMP_CWORD]}")
+
+ # Since we have removed all words after COMP_CWORD, we can safely assume
+ # that COMP_CWORD_NO_FLAGS is simply the index of the last element
+ local COMP_CWORD_NO_FLAGS=$(( ${#COMP_WORDS_NO_FLAGS[@]} - 1 ))
+
+ # There is no guarantee that the cursor is at the end of the command line
+ # when tab completion is envoked. For example, in the following situation:
+ # `spack -d [] install`
+ # if the user presses the TAB key, a list of valid flags should be listed.
+ # Note that we cannot simply ignore everything after the cursor. In the
+ # previous scenario, the user should expect to see a list of flags, but
+ # not of other subcommands. Obviously, `spack -d list install` would be
+ # invalid syntax. To accomplish this, we use the variable list_options
+ # which is true if the current word starts with '-' or if the cursor is
+ # not at the end of the line.
+ local list_options=false
+ if [[ "${COMP_WORDS[$COMP_CWORD]}" == -* || \
+ "$COMP_CWORD" -ne "${#COMP_WORDS[@]}-1" ]]
+ then
+ list_options=true
+ fi
+
+ # In general, when envoking tab completion, the user is not expecting to
+ # see optional flags mixed in with subcommands or package names. Tab
+ # completion is used by those who are either lazy or just bad at spelling.
+ # If someone doesn't remember what flag to use, seeing single letter flags
+ # in their results won't help them, and they should instead consult the
+ # documentation. However, if the user explicitly declares that they are
+ # looking for a flag, we can certainly help them out.
+ # `spack install -[]`
+ # and
+ # `spack install --[]`
+ # should list all flags and long flags, respectively. Furthermore, if a
+ # subcommand has no non-flag completions, such as `spack arch []`, it
+ # should list flag completions.
+
+ local cur=${COMP_WORDS_NO_FLAGS[$COMP_CWORD_NO_FLAGS]}
+ local prev=${COMP_WORDS_NO_FLAGS[$COMP_CWORD_NO_FLAGS-1]}
+
+ #_test_vars
+
+ # Make sure function exists before calling it
+ if [[ "$(type -t $subfunction)" == "function" ]]
+ then
+ COMPREPLY=($($subfunction))
+ fi
+}
+
+# Spack commands
+
+function _spack {
+ if $list_options
+ then
+ compgen -W "-h --help -d --debug -D --pdb -k --insecure -m --mock -p
+ --profile -v --verbose -s --stacktrace -V --version
+ --color --color=always --color=auto --color=never" -- "$cur"
+ else
+ compgen -W "$(_subcommands)" -- "$cur"
+ fi
+}
+
+function _spack_activate {
+ if $list_options
+ then
+ compgen -W "-h --help -f --force" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_arch {
+ compgen -W "-h --help -p --platform" -- "$cur"
+}
+
+function _spack_bootstrap {
+ # FIXME: What does this command even do?
+ if $list_options
+ then
+ compgen -W "-h --help -r --remote" -- "$cur"
+ fi
+}
+
+function _spack_build {
+ if $list_options
+ then
+ compgen -W "-h --help -v --verbose" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_buildcache {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "create install keys list" -- "$cur"
+ fi
+}
+
+function _spack_buildcache_create {
+ if $list_options
+ then
+ compgen -W "-h --help -r --rel -f --force -y --yes-to-all -k --key
+ -d --directory" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_buildcache_install {
+ if $list_options
+ then
+ compgen -W "-h --help -f --force -y --yes-to-all" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_buildcache_keys {
+ if $list_options
+ then
+ compgen -W "-h --help -i --install -y --yes-to-all" -- "$cur"
+ fi
+}
+
+function _spack_buildcache_list {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_cd {
+ if $list_options
+ then
+ compgen -W "-h --help -m --module-dir -r --spack-root -i --install-dir
+ -p --package-dir -P --packages -s --stage-dir -S --stages
+ -b --build-dir" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_checksum {
+ if $list_options
+ then
+ compgen -W "-h --help --keep-stage" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_clean {
+ if $list_options
+ then
+ compgen -W "-h --help -s --stage -d --downloads
+ -m --misc-cache -a --all" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_compiler {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "find add remove rm list info" -- "$cur"
+ fi
+}
+
+function _spack_compiler_add {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ fi
+}
+
+function _spack_compiler_find {
+ # Alias to `spack compiler add`
+ _spack_compiler_add
+}
+
+function _spack_compiler_info {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ else
+ compgen -W "$(_installed_compilers)" -- "$cur"
+ fi
+}
+
+function _spack_compiler_list {
+ compgen -W "-h --help --scope" -- "$cur"
+}
+
+function _spack_compiler_remove {
+ if $list_options
+ then
+ compgen -W "-h --help -a --all --scope" -- "$cur"
+ else
+ compgen -W "$(_installed_compilers)" -- "$cur"
+ fi
+}
+
+function _spack_compiler_rm {
+ # Alias to `spack compiler remove`
+ _spack_compiler_remove
+}
+
+function _spack_compilers {
+ compgen -W "-h --help --scope" -- "$cur"
+}
+
+function _spack_config {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ else
+ compgen -W "edit get" -- "$cur"
+ fi
+}
+
+function _spack_config_edit {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "mirrors repos modules packages config compilers" -- "$cur"
+ fi
+}
+
+function _spack_config_get {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "mirrors repos modules packages config compilers" -- "$cur"
+ fi
+}
+
+function _spack_configure {
+ if $list_options
+ then
+ compgen -W "-h --help -v --verbose" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_create {
+ compgen -W "-h --help --keep-stage -n --name -t --template -r --repo
+ -N --namespace -f --force" -- "$cur"
+}
+
+function _spack_deactivate {
+ if $list_options
+ then
+ compgen -W "-h --help -f --force -a --all" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_debug {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "create-db-tarball" -- "$cur"
+ fi
+}
+
+function _spack_debug_create_db_tarball {
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_dependents {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_diy {
+ if $list_options
+ then
+ compgen -W "-h --help -i --ignore-dependencies --keep-prefix
+ --skip-patch -q --quiet --clean --dirty" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_doc {
+ # FIXME: What does this command even do?
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_edit {
+ if $list_options
+ then
+ compgen -W "-h --help -b --build-system -c --command -t --test -m --module
+ -r --repo -N --namespace" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_env {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_extensions {
+ if $list_options
+ then
+ compgen -W "-h --help -l --long -p --paths -d --deps" -- "$cur"
+ else
+ compgen -W "go-bootstrap go lua octave python r ruby rust" -- "$cur"
+ fi
+}
+
+function _spack_fetch {
+ if $list_options
+ then
+ compgen -W "-h --help -n --no-checksum -m --missing
+ -D --dependencies" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_find {
+ if $list_options
+ then
+ compgen -W "-h --help -s --short -p --paths -d --deps -l --long
+ -L --very-long -f --show-flags --show-full-compiler
+ -e --explicit -E --implicit -u --unknown -m --missing
+ -v --variants -M --only-missing -N --namespace" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_flake8 {
+ if $list_options
+ then
+ compgen -W "-h --help -k --keep-temp -o --output
+ -r --root-relative -U --no-untracked" -- "$cur"
+ fi
+}
+
+function _spack_graph {
+ if $list_options
+ then
+ compgen -W "-h --help -a --ascii -d --dot -n --normalize -s --static
+ -i --installed -t --deptype" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_help {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_subcommands)" -- "$cur"
+ fi
+}
+
+function _spack_info {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_install {
+ if $list_options
+ then
+ compgen -W "-h --help --only -j --jobs --keep-prefix --keep-stage
+ -n --no-checksum -v --verbose --fake --clean --dirty
+ --run-tests --log-format --log-file --source" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_list {
+ if $list_options
+ then
+ compgen -W "-h --help -d --search-description --format" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_load {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_location {
+ if $list_options
+ then
+ compgen -W "-h --help -m --module-dir -r --spack-root -i --install-dir
+ -p --package-dir -P --packages -s --stage-dir -S --stages
+ -b --build-dir" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_md5 {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_mirror {
+ if $list_options
+ then
+ compgen -W "-h --help -n --no-checksum" -- "$cur"
+ else
+ compgen -W "add create list remove rm" -- "$cur"
+ fi
+}
+
+function _spack_mirror_add {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ fi
+}
+
+function _spack_mirror_create {
+ if $list_options
+ then
+ compgen -W "-h --help -d --directory -f --file
+ -D --dependencies -o --one-version-per-spec" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_mirror_list {
+ compgen -W "-h --help --scope" -- "$cur"
+}
+
+function _spack_mirror_remove {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ else
+ compgen -W "$(_mirrors)" -- "$cur"
+ fi
+}
+
+function _spack_module {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "find loads refresh rm" -- "$cur"
+ fi
+}
+
+function _spack_module_find {
+ if $list_options
+ then
+ compgen -W "-h --help -m --module-type" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_module_loads {
+ if $list_options
+ then
+ compgen -W "-h --help --input-only -p --prefix -x --exclude
+ -m --module-type -r --dependencies" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+
+}
+
+function _spack_module_refresh {
+ if $list_options
+ then
+ compgen -W "-h --help --delete-tree -m --module-type
+ -y --yes-to-all" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_module_rm {
+ if $list_options
+ then
+ compgen -W "-h --help -m --module-type -y --yes-to-all" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_patch {
+ if $list_options
+ then
+ compgen -W "-h --help -n --no-checksum" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_pkg {
+ # FIXME: What does this subcommand even do?
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "add added diff list removed" -- "$cur"
+ fi
+}
+
+function _spack_pkg_add {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_pkg_added {
+ # FIXME: How to list git revisions?
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_pkg_diff {
+ # FIXME: How to list git revisions?
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_pkg_list {
+ # FIXME: How to list git revisions?
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_pkg_removed {
+ # FIXME: How to list git revisions?
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_providers {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "awk blas daal elf golang ipp lapack mkl
+ mpe mpi opencl openfoam pil scalapack" -- "$cur"
+ fi
+}
+
+function _spack_python {
+ if $list_options
+ then
+ compgen -W "-h --help -c" -- "$cur"
+ fi
+}
+
+function _spack_reindex {
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_repo {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "add create list remove rm" -- "$cur"
+ fi
+}
+
+function _spack_repo_add {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ fi
+}
+
+function _spack_repo_create {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_repo_list {
+ compgen -W "-h --help --scope" -- "$cur"
+}
+
+function _spack_repo_remove {
+ if $list_options
+ then
+ compgen -W "-h --help --scope" -- "$cur"
+ else
+ compgen -W "$(_repos)" -- "$cur"
+ fi
+}
+
+function _spack_repo_rm {
+ # Alias to `spack repo remove`
+ _spack_repo_remove
+}
+
+function _spack_restage {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_setup {
+ if $list_options
+ then
+ compgen -W "-h --help -i --ignore-dependencies -v --verbose
+ --clean --dirty" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_spec {
+ if $list_options
+ then
+ compgen -W "-h --help -l --long -L --very-long -y --yaml -c --cover
+ -N --namespaces -I --install-status -t --types" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_stage {
+ if $list_options
+ then
+ compgen -W "-h --help -n --no-checksum -p --path" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_test {
+ if $list_options
+ then
+ compgen -W "-h --help -H --pytest-help -l --list
+ -L --long-list" -- "$cur"
+ else
+ compgen -W "$(_tests)" -- "$cur"
+ fi
+}
+
+function _spack_uninstall {
+ if $list_options
+ then
+ compgen -W "-h --help -f --force -a --all -R --dependents
+ -y --yes-to-all" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_unload {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)"
+ fi
+}
+
+function _spack_unuse {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)"
+ fi
+}
+
+function _spack_url {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "list parse summary" -- "$cur"
+ fi
+}
+
+function _spack_url_list {
+ compgen -W "-h --help -c --color -e --extrapolation
+ -n --incorrect-name -N --correct-name
+ -v --incorrect-version -V --correct-version" -- "$cur"
+}
+
+function _spack_url_parse {
+ compgen -W "-h --help -s --spider" -- "$cur"
+}
+
+function _spack_url_summary {
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_use {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_versions {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
+function _spack_view {
+ if $list_options
+ then
+ compgen -W "-h --help -v --verbose -e --exclude
+ -d --dependencies" -- "$cur"
+ else
+ compgen -W "add check hard hardlink remove rm soft
+ statlink status symlink" -- "$cur"
+ fi
+}
+
+function _spack_view_add {
+ # Alias for `spack view symlink`
+ _spack_view_symlink
+}
+
+function _spack_view_check {
+ # Alias for `spack view statlink`
+ _spack_view_statlink
+}
+
+function _spack_view_hard {
+ # Alias for `spack view hardlink`
+ _spack_view_hardlink
+}
+
+function _spack_view_hardlink {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_view_remove {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_view_rm {
+ # Alias for `spack view remove`
+ _spack_view_remove
+}
+
+function _spack_view_soft {
+ # Alias for `spack view symlink`
+ _spack_view_symlink
+}
+
+function _spack_view_statlink {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_view_status {
+ # Alias for `spack view statlink`
+ _spack_view_statlink
+}
+
+function _spack_view_symlink {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+# Helper functions for subcommands
+
+function _subcommands {
+ spack help --all | grep "^ [a-z]" | awk '{print $1}' | grep -v spack
+}
+
+function _all_packages {
+ spack list
+}
+
+function _installed_packages {
+ # Perl one-liner used to strip out color codes
+ spack find | grep -v "^--" | perl -pe 's/\e\[?.*?[\@-~]//g'
+}
+
+function _installed_compilers {
+ spack compilers | egrep -v "^(-|=)"
+}
+
+function _mirrors {
+ spack mirror list | awk '{print $1}'
+}
+
+function _repos {
+ spack repo list | awk '{print $1}'
+}
+
+function _tests {
+ spack test -l
+}
+
+# Testing functions
+
+function _test_vars {
+ echo "-----------------------------------------------------" >> temp
+ echo "Full line: '$COMP_LINE'" >> temp
+ echo >> temp
+ echo "Word list w/ flags: $(_pretty_print COMP_WORDS[@])" >> temp
+ echo "# words w/ flags: '${#COMP_WORDS[@]}'" >> temp
+ echo "Cursor index w/ flags: '$COMP_CWORD'" >> temp
+ echo >> temp
+ echo "Word list w/out flags: $(_pretty_print COMP_WORDS_NO_FLAGS[@])" >> temp
+ echo "# words w/out flags: '${#COMP_WORDS_NO_FLAGS[@]}'" >> temp
+ echo "Cursor index w/out flags: '$COMP_CWORD_NO_FLAGS'" >> temp
+ echo >> temp
+ echo "Subfunction: '$subfunction'" >> temp
+ if $list_options
+ then
+ echo "List options: 'True'" >> temp
+ else
+ echo "List options: 'False'" >> temp
+ fi
+ echo "Current word: '$cur'" >> temp
+ echo "Previous word: '$prev'" >> temp
+}
+
+# Pretty-prints one or more arrays
+# Syntax: _pretty_print array1[@] ...
+function _pretty_print {
+ for arg in $@
+ do
+ local array=("${!arg}")
+ echo -n "$arg: ["
+ printf "'%s'" "${array[0]}"
+ printf ", '%s'" "${array[@]:1}"
+ echo "]"
+ done
+}
+
+complete -o default -F _bash_completion_spack spack