summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xbin/spack3
-rw-r--r--lib/spack/docs/index.rst6
-rw-r--r--lib/spack/docs/tutorial/examples/0.package.py (renamed from lib/spack/docs/packaging_tutorial/0.package.py)0
-rw-r--r--lib/spack/docs/tutorial/examples/1.package.py (renamed from lib/spack/docs/packaging_tutorial/1.package.py)0
-rw-r--r--lib/spack/docs/tutorial/examples/2.package.py (renamed from lib/spack/docs/packaging_tutorial/2.package.py)0
-rw-r--r--lib/spack/docs/tutorial/examples/3.package.py (renamed from lib/spack/docs/packaging_tutorial/3.package.py)0
-rw-r--r--lib/spack/docs/tutorial/examples/4.package.py (renamed from lib/spack/docs/packaging_tutorial/4.package.py)0
-rw-r--r--lib/spack/docs/tutorial/sc16-tutorial-slide-preview.pngbin0 -> 71641 bytes
-rw-r--r--lib/spack/docs/tutorial_sc16.rst48
-rw-r--r--lib/spack/docs/tutorial_sc16_modules.rst (renamed from lib/spack/docs/module_file_tutorial.rst)2
-rw-r--r--lib/spack/docs/tutorial_sc16_packaging.rst (renamed from lib/spack/docs/package_tutorial.rst)22
-rw-r--r--lib/spack/docs/tutorial_sc16_spack_basics.rst (renamed from lib/spack/docs/basic_usage_tutorial.rst)2
-rw-r--r--lib/spack/llnl/util/tty/__init__.py41
-rw-r--r--var/spack/repos/builtin/packages/llvm-lld/package.py2
-rw-r--r--var/spack/repos/builtin/packages/py-pathspec/package.py41
-rw-r--r--var/spack/repos/builtin/packages/python/package.py19
17 files changed, 169 insertions, 20 deletions
diff --git a/README.md b/README.md
index 853e071fc6..9d005605eb 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,9 @@ Documentation
[**Full documentation**](http://spack.readthedocs.io/) for Spack is
the first place to look.
+We've also got a [**Spack 101 Tutorial**](http://spack.readthedocs.io/en/latest/tutorial_sc16.html),
+so you can learn Spack yourself, or teach users at your own site.
+
See also:
* [Technical paper](http://www.computer.org/csdl/proceedings/sc/2015/3723/00/2807623.pdf) and
[slides](https://tgamblin.github.io/files/Gamblin-Spack-SC15-Talk.pdf) on Spack's design and implementation.
diff --git a/bin/spack b/bin/spack
index 1f5dec0b3d..7cc1b28a37 100755
--- a/bin/spack
+++ b/bin/spack
@@ -128,6 +128,8 @@ parser.add_argument('-p', '--profile', action='store_true',
help="Profile execution using cProfile.")
parser.add_argument('-v', '--verbose', action='store_true',
help="Print additional output during builds")
+parser.add_argument('-s', '--stacktrace', action='store_true',
+ help="Add stacktrace information to all printed statements")
parser.add_argument('-V', '--version', action='version',
version="%s" % spack.spack_version)
@@ -155,6 +157,7 @@ def main():
# Set up environment based on args.
tty.set_verbose(args.verbose)
tty.set_debug(args.debug)
+ tty.set_stacktrace(args.stacktrace)
spack.debug = args.debug
if spack.debug:
diff --git a/lib/spack/docs/index.rst b/lib/spack/docs/index.rst
index 65fb995d1e..ed2ff96ed0 100644
--- a/lib/spack/docs/index.rst
+++ b/lib/spack/docs/index.rst
@@ -61,11 +61,9 @@ or refer to the full manual below.
.. toctree::
:maxdepth: 2
- :caption: Step-by-step
+ :caption: Tutorial
- basic_usage_tutorial
- module_file_tutorial
- package_tutorial
+ tutorial_sc16
.. toctree::
:maxdepth: 2
diff --git a/lib/spack/docs/packaging_tutorial/0.package.py b/lib/spack/docs/tutorial/examples/0.package.py
index ad6fd4d077..ad6fd4d077 100644
--- a/lib/spack/docs/packaging_tutorial/0.package.py
+++ b/lib/spack/docs/tutorial/examples/0.package.py
diff --git a/lib/spack/docs/packaging_tutorial/1.package.py b/lib/spack/docs/tutorial/examples/1.package.py
index afacf3bbe8..afacf3bbe8 100644
--- a/lib/spack/docs/packaging_tutorial/1.package.py
+++ b/lib/spack/docs/tutorial/examples/1.package.py
diff --git a/lib/spack/docs/packaging_tutorial/2.package.py b/lib/spack/docs/tutorial/examples/2.package.py
index f7000cd1b6..f7000cd1b6 100644
--- a/lib/spack/docs/packaging_tutorial/2.package.py
+++ b/lib/spack/docs/tutorial/examples/2.package.py
diff --git a/lib/spack/docs/packaging_tutorial/3.package.py b/lib/spack/docs/tutorial/examples/3.package.py
index 6e7e5e2f3c..6e7e5e2f3c 100644
--- a/lib/spack/docs/packaging_tutorial/3.package.py
+++ b/lib/spack/docs/tutorial/examples/3.package.py
diff --git a/lib/spack/docs/packaging_tutorial/4.package.py b/lib/spack/docs/tutorial/examples/4.package.py
index 3294b86e25..3294b86e25 100644
--- a/lib/spack/docs/packaging_tutorial/4.package.py
+++ b/lib/spack/docs/tutorial/examples/4.package.py
diff --git a/lib/spack/docs/tutorial/sc16-tutorial-slide-preview.png b/lib/spack/docs/tutorial/sc16-tutorial-slide-preview.png
new file mode 100644
index 0000000000..e7f9b2e323
--- /dev/null
+++ b/lib/spack/docs/tutorial/sc16-tutorial-slide-preview.png
Binary files differ
diff --git a/lib/spack/docs/tutorial_sc16.rst b/lib/spack/docs/tutorial_sc16.rst
new file mode 100644
index 0000000000..6fa630c57b
--- /dev/null
+++ b/lib/spack/docs/tutorial_sc16.rst
@@ -0,0 +1,48 @@
+.. _spack-101:
+
+=============================
+Spack 101
+=============================
+
+This is a 3-hour introduction to Spack with lectures and live demos. It
+was presented as a tutorial at `Supercomputing 2016
+<http://sc16.supercomputing.org>`_. You can use these materials to teach
+a course on Spack at your own site, or you can just skip ahead and read
+the live demo scripts to see how Spack is used in practice.
+
+.. _sc16-slides:
+
+.. rubric:: Slides
+
+.. figure:: tutorial/sc16-tutorial-slide-preview.png
+ :target: http://software.llnl.gov/spack/files/Spack-SC16-Tutorial.pdf
+ :height: 72px
+ :align: left
+ :alt: Slide Preview
+
+`Download Slides <software.llnl.gov/spack/files/Spack-SC16-Tutorial.pdf>`_.
+
+**Full citation:** Todd Gamblin, Massimiliano Culpo, Gregory Becker, Matt
+Legendre, Greg Lee, Elizabeth Fischer, and Benedikt Hegner.
+`Managing HPC Software Complexity with Spack
+<http://sc16.supercomputing.org/presentation/?id=tut166&sess=sess209>`_.
+Tutorial presented at Supercomputing 2016. November 13, 2016, Salt Lake
+City, UT, USA.
+
+.. _sc16-live-demos:
+
+.. rubric:: Live Demos
+
+These scripts will take you step-by-step through basic Spack tasks. They
+correspond to sections in the slides above.
+
+ 1. :ref:`basics-tutorial`
+ 2. :ref:`packaging-tutorial`
+ 3. :ref:`modules-tutorial`
+
+Full contents:
+
+.. toctree::
+ tutorial_sc16_spack_basics
+ tutorial_sc16_packaging
+ tutorial_sc16_modules
diff --git a/lib/spack/docs/module_file_tutorial.rst b/lib/spack/docs/tutorial_sc16_modules.rst
index 83df756566..1e786674bb 100644
--- a/lib/spack/docs/module_file_tutorial.rst
+++ b/lib/spack/docs/tutorial_sc16_modules.rst
@@ -1,4 +1,4 @@
-.. _module_tutorial:
+.. _modules-tutorial:
=============================
Module Configuration Tutorial
diff --git a/lib/spack/docs/package_tutorial.rst b/lib/spack/docs/tutorial_sc16_packaging.rst
index e955780345..41c938327e 100644
--- a/lib/spack/docs/package_tutorial.rst
+++ b/lib/spack/docs/tutorial_sc16_packaging.rst
@@ -1,4 +1,4 @@
-.. _package_tutorial:
+.. _packaging-tutorial:
=========================
Package Creation Tutorial
@@ -37,7 +37,7 @@ A few things before we get started:
editor you like.
- We'll be writting Python code as part of this tutorial. You can find
successive versions of the Python code in
- ``$SPACK_ROOT/lib/spack/docs/packaging_tutorial``.
+ ``$SPACK_ROOT/lib/spack/docs/tutorial/examples``.
-------------------------
Creating the Package File
@@ -61,7 +61,7 @@ we run ``spack create`` on it:
And Spack should spawn a text editor with this file:
-.. literalinclude:: packaging_tutorial/0.package.py
+.. literalinclude:: tutorial/examples/0.package.py
:start-after: # flake8: noqa
:language: python
@@ -122,10 +122,10 @@ Let's remove some of the ``TODO`` comments, and add links to the mpileaks
homepage and document what mpileaks does. I'm also going to cut out the
Copyright clause at this point to keep this tutorial document shorter,
but you shouldn't do that normally. The results of these changes can be
-found in ``$SPACK_ROOT/lib/spack/docs/packaging_tutorial/1.package.py``
+found in ``$SPACK_ROOT/lib/spack/docs/tutorial/examples/1.package.py``
and are below. Make these changes to your ``package.py``:
-.. literalinclude:: packaging_tutorial/1.package.py
+.. literalinclude:: tutorial/examples/1.package.py
:start-after: # flake8: noqa
:language: python
@@ -174,9 +174,9 @@ Dependencies
The mpileaks packages depends on three other package: ``MPI``,
``adept-utils``, and ``callpath``. Let's add those via the
``depends_on`` command in our ``package.py`` (this version is in
-``$SPACK_ROOT/lib/spack/docs/packaging_tutorial/2.package.py``):
+``$SPACK_ROOT/lib/spack/docs/tutorial/examples/2.package.py``):
-.. literalinclude:: packaging_tutorial/2.package.py
+.. literalinclude:: tutorial/examples/2.package.py
:start-after: # flake8: noqa
:language: python
@@ -329,9 +329,9 @@ Specifying Configure Arguments
Let's add the configure arguments to the mpileaks' ``package.py``. This
version can be found in
-``$SPACK_ROOT/lib/spack/docs/packaging_tutorial/3.package.py``:
+``$SPACK_ROOT/lib/spack/docs/tutorial/examples/3.package.py``:
-.. literalinclude:: packaging_tutorial/3.package.py
+.. literalinclude:: tutorial/examples/3.package.py
:start-after: # flake8: noqa
:language: python
@@ -382,9 +382,9 @@ that it walks. Let's add a variant to allow users to set this when they
build in Spack.
To do this, we'll add a variant to our package, as per the following (see
-``$SPACK_ROOT/lib/spack/docs/packaging_tutorial/4.package.py``):
+``$SPACK_ROOT/lib/spack/docs/tutorial/examples/4.package.py``):
-.. literalinclude:: packaging_tutorial/4.package.py
+.. literalinclude:: tutorial/examples/4.package.py
:start-after: # flake8: noqa
:language: python
diff --git a/lib/spack/docs/basic_usage_tutorial.rst b/lib/spack/docs/tutorial_sc16_spack_basics.rst
index cf8c654c0f..d83d6e4064 100644
--- a/lib/spack/docs/basic_usage_tutorial.rst
+++ b/lib/spack/docs/tutorial_sc16_spack_basics.rst
@@ -1,4 +1,4 @@
-.. _basics_tutorial:
+.. _basics-tutorial:
=========================================
Basic Installation Tutorial
diff --git a/lib/spack/llnl/util/tty/__init__.py b/lib/spack/llnl/util/tty/__init__.py
index db74aaba6b..1381bb2f7d 100644
--- a/lib/spack/llnl/util/tty/__init__.py
+++ b/lib/spack/llnl/util/tty/__init__.py
@@ -28,12 +28,14 @@ import textwrap
import fcntl
import termios
import struct
+import traceback
from StringIO import StringIO
from llnl.util.tty.color import *
_debug = False
_verbose = False
+_stacktrace = False
indent = " "
@@ -45,6 +47,10 @@ def is_debug():
return _debug
+def is_stacktrace():
+ return _stacktrace
+
+
def set_debug(flag):
global _debug
_debug = flag
@@ -53,10 +59,35 @@ def set_debug(flag):
def set_verbose(flag):
global _verbose
_verbose = flag
+
+
+def set_stacktrace(flag):
+ global _stacktrace
+ _stacktrace = flag
+
+
+def process_stacktrace(countback):
+ """Gives file and line frame 'countback' frames from the bottom"""
+ st = traceback.extract_stack()
+ # Not all entries may be spack files, we have to remove those that aren't.
+ file_list = []
+ for frame in st:
+ # Check that the file is a spack file
+ if frame[0].find("/spack") >= 0:
+ file_list.append(frame[0])
+ # We use commonprefix to find what the spack 'root' directory is.
+ root_dir = os.path.commonprefix(file_list)
+ root_len = len(root_dir)
+ st_idx = len(st) - countback - 1
+ st_text = "%s:%i " % (st[st_idx][0][root_len:], st[st_idx][1])
+ return st_text
def msg(message, *args):
- cprint("@*b{==>} %s" % cescape(message))
+ st_text = ""
+ if _stacktrace:
+ st_text = process_stacktrace(2)
+ cprint("@*b{%s==>} %s" % (st_text, cescape(message)))
for arg in args:
print indent + str(arg)
@@ -66,8 +97,13 @@ def info(message, *args, **kwargs):
stream = kwargs.get('stream', sys.stdout)
wrap = kwargs.get('wrap', False)
break_long_words = kwargs.get('break_long_words', False)
+ st_countback = kwargs.get('countback', 3)
- cprint("@%s{==>} %s" % (format, cescape(str(message))), stream=stream)
+ st_text = ""
+ if _stacktrace:
+ st_text = process_stacktrace(st_countback)
+ cprint("@%s{%s==>} %s" % (format, st_text, cescape(str(message))),
+ stream=stream)
for arg in args:
if wrap:
lines = textwrap.wrap(
@@ -105,6 +141,7 @@ def warn(message, *args, **kwargs):
def die(message, *args, **kwargs):
+ kwargs.setdefault('countback', 4)
error(message, *args, **kwargs)
sys.exit(1)
diff --git a/var/spack/repos/builtin/packages/llvm-lld/package.py b/var/spack/repos/builtin/packages/llvm-lld/package.py
index 1dcf88e3c0..6a167cca33 100644
--- a/var/spack/repos/builtin/packages/llvm-lld/package.py
+++ b/var/spack/repos/builtin/packages/llvm-lld/package.py
@@ -38,7 +38,7 @@ class LlvmLld(Package):
depends_on('cmake', type='build')
def install(self, spec, prefix):
- env['CXXFLAGS'] = self.compier.cxx11_flag
+ env['CXXFLAGS'] = self.compiler.cxx11_flag
with working_dir('spack-build', create=True):
cmake('..',
diff --git a/var/spack/repos/builtin/packages/py-pathspec/package.py b/var/spack/repos/builtin/packages/py-pathspec/package.py
new file mode 100644
index 0000000000..399f3c91ef
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-pathspec/package.py
@@ -0,0 +1,41 @@
+##############################################################################
+# Copyright (c) 2016, 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.
+#
+# 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
+##############################################################################
+from spack import *
+
+
+class PyPathspec(Package):
+ """pathspec extends the test loading and running features of unittest,
+ making it easier to write, find and run tests."""
+
+ homepage = "https://pypi.python.org/pypi/pathspec"
+
+ version('0.3.4', '2a4af9bf2dee98845d583ec61a00d05d',
+ url='https://pypi.python.org/packages/14/9d/c9d790d373d6f6938d793e9c549b87ad8670b6fa7fc6176485e6ef11c1a4/pathspec-0.3.4.tar.gz')
+
+ extends('python')
+ depends_on('py-setuptools', type='build')
+
+ def install(self, spec, prefix):
+ setup_py('install', '--prefix=%s' % prefix)
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 370e14b2ae..bf34b83c99 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -134,6 +134,25 @@ class Python(Package):
self.filter_compilers(spec, prefix)
+ # TODO:
+ # On OpenSuse 13, python uses <prefix>/lib64/python2.7/lib-dynload/*.so
+ # instead of <prefix>/lib/python2.7/lib-dynload/*.so. Oddly enough the
+ # result is that Python can not find modules like cPickle. A workaround
+ # for now is to symlink to `lib`:
+ src = os.path.join(prefix,
+ 'lib64',
+ 'python{0}'.format(self.version.up_to(2)),
+ 'lib-dynload')
+ dst = os.path.join(prefix,
+ 'lib',
+ 'python{0}'.format(self.version.up_to(2)),
+ 'lib-dynload')
+ if os.path.isdir(src) and not os.path.isdir(dst):
+ mkdirp(dst)
+ for f in os.listdir(src):
+ os.symlink(os.path.join(src, f),
+ os.path.join(dst, f))
+
# TODO: Once better testing support is integrated, add the following tests
# https://wiki.python.org/moin/TkInter
#