diff options
-rw-r--r-- | lib/spack/spack/cmd/md5.py | 33 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/caliper/package.py | 25 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/py-wheel/package.py | 15 |
3 files changed, 66 insertions, 7 deletions
diff --git a/lib/spack/spack/cmd/md5.py b/lib/spack/spack/cmd/md5.py index ef1e4f3475..879ef9f7b7 100644 --- a/lib/spack/spack/cmd/md5.py +++ b/lib/spack/spack/cmd/md5.py @@ -23,15 +23,31 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import os -import hashlib import argparse +import hashlib + +from contextlib import contextmanager import llnl.util.tty as tty from llnl.util.filesystem import * import spack.util.crypto +from spack.stage import Stage, FailedDownloadError + +description = "Calculate md5 checksums for files/urls." -description = "Calculate md5 checksums for files." +@contextmanager +def stager(url): + _cwd = os.getcwd() + _stager = Stage(url) + try: + _stager.fetch() + yield _stager + except FailedDownloadError: + tty.msg("Failed to fetch %s" % url) + finally: + _stager.destroy() + os.chdir(_cwd) # the Stage class changes the current working dir so it has to be restored def setup_parser(subparser): setup_parser.parser = subparser @@ -45,9 +61,12 @@ def md5(parser, args): for f in args.files: if not os.path.isfile(f): - tty.die("Not a file: %s" % f) - if not can_access(f): - tty.die("Cannot read file: %s" % f) + with stager(f) as stage: + checksum = spack.util.crypto.checksum(hashlib.md5, stage.archive_file) + print "%s %s" % (checksum, f) + else: + if not can_access(f): + tty.die("Cannot read file: %s" % f) - checksum = spack.util.crypto.checksum(hashlib.md5, f) - print "%s %s" % (checksum, f) + checksum = spack.util.crypto.checksum(hashlib.md5, f) + print "%s %s" % (checksum, f) diff --git a/var/spack/repos/builtin/packages/caliper/package.py b/var/spack/repos/builtin/packages/caliper/package.py new file mode 100644 index 0000000000..d51b4a4dd5 --- /dev/null +++ b/var/spack/repos/builtin/packages/caliper/package.py @@ -0,0 +1,25 @@ +from spack import * + +class Caliper(Package): + """ + Caliper is a generic context annotation system. It gives programmers the + ability to provide arbitrary program context information to (performance) + tools at runtime. + """ + + homepage = "https://github.com/LLNL/Caliper" + url = "" + + version('master', git='ssh://git@github.com:LLNL/Caliper.git') + + variant('mpi', default=False, description='Enable MPI function wrappers.') + + depends_on('libunwind') + depends_on('papi') + depends_on('mpi', when='+mpi') + + def install(self, spec, prefix): + with working_dir('build', create=True): + cmake('..', *std_cmake_args) + make() + make("install") diff --git a/var/spack/repos/builtin/packages/py-wheel/package.py b/var/spack/repos/builtin/packages/py-wheel/package.py new file mode 100644 index 0000000000..3118e74519 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-wheel/package.py @@ -0,0 +1,15 @@ +from spack import * + +class PyWheel(Package): + """A built-package format for Python.""" + + homepage = "https://pypi.python.org/pypi/wheel" + url = "https://pypi.python.org/packages/source/w/wheel/wheel-0.26.0.tar.gz" + + version('0.26.0', '4cfc6e7e3dc7377d0164914623922a10') + + extends('python') + depends_on('py-setuptools') + + def install(self, spec, prefix): + python('setup.py', 'install', '--prefix=%s' % prefix) |