summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/package.py7
-rw-r--r--lib/spack/spack/stage.py24
-rw-r--r--lib/spack/spack/test/stage.py35
-rw-r--r--var/spack/repos/builtin/packages/hdf5/package.py11
-rw-r--r--var/spack/repos/builtin/packages/petsc/package.py22
5 files changed, 70 insertions, 29 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 972a0410b9..ca9e9c4bd1 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -825,7 +825,7 @@ class Package(object):
def do_install(self,
- keep_prefix=False, keep_stage=None, ignore_deps=False,
+ keep_prefix=False, keep_stage=False, ignore_deps=False,
skip_patch=False, verbose=False, make_jobs=None, fake=False):
"""Called by commands to install a package and its dependencies.
@@ -834,8 +834,9 @@ class Package(object):
Args:
keep_prefix -- Keep install prefix on failure. By default, destroys it.
- keep_stage -- Set to True or false to always keep or always delete stage.
- By default, stage is destroyed only if there are no exceptions.
+ keep_stage -- By default, stage is destroyed only if there are no
+ exceptions during build. Set to True to keep the stage
+ even with exceptions.
ignore_deps -- Do not install dependencies before installing this package.
fake -- Don't really build -- install fake stub files instead.
skip_patch -- Skip patch stage of build if True.
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 5354135e6a..f88f82fc2d 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -88,7 +88,8 @@ class Stage(object):
similar, and are intended to persist for only one run of spack.
"""
- def __init__(self, url_or_fetch_strategy, name=None, mirror_path=None, keep=None):
+ def __init__(self, url_or_fetch_strategy,
+ name=None, mirror_path=None, keep=False):
"""Create a stage object.
Parameters:
url_or_fetch_strategy
@@ -108,10 +109,9 @@ class Stage(object):
keep
By default, when used as a context manager, the Stage
- is cleaned up when everything goes well, and it is
- kept intact when an exception is raised. You can
- override this behavior by setting keep to True
- (always keep) or False (always delete).
+ is deleted on exit when no exceptions are raised.
+ Pass True to keep the stage intact even if no
+ exceptions are raised.
"""
# TODO: fetch/stage coupling needs to be reworked -- the logic
# TODO: here is convoluted and not modular enough.
@@ -166,12 +166,8 @@ class Stage(object):
Returns:
Boolean
"""
- if self.keep is None:
- # Default: delete when there are no exceptions.
- if exc_type is None: self.destroy()
-
- elif not self.keep:
- # Overridden. Either always keep or always delete.
+ # Delete when there are no exceptions, unless asked to keep.
+ if exc_type is None and not self.keep:
self.destroy()
@@ -195,8 +191,8 @@ class Stage(object):
real_tmp = os.path.realpath(self.tmp_root)
if spack.use_tmp_stage:
- # If we're using a tmp dir, it's a link, and it points at the right spot,
- # then keep it.
+ # If we're using a tmp dir, it's a link, and it points at the
+ # right spot, then keep it.
if (real_path.startswith(real_tmp) and os.path.exists(real_path)):
return False
else:
@@ -441,7 +437,7 @@ class StageComposite:
def __exit__(self, exc_type, exc_val, exc_tb):
for item in reversed(self):
- item.keep = getattr(self, 'keep', None)
+ item.keep = getattr(self, 'keep', False)
item.__exit__(exc_type, exc_val, exc_tb)
#
diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py
index dbcf89d864..ea425127c4 100644
--- a/lib/spack/spack/test/stage.py
+++ b/lib/spack/spack/test/stage.py
@@ -277,3 +277,38 @@ class StageTest(unittest.TestCase):
self.check_chdir_to_source(stage, stage_name)
self.assertFalse('foobar' in os.listdir(stage.source_path))
self.check_destroy(stage, stage_name)
+
+
+ def test_no_keep_without_exceptions(self):
+ with Stage(archive_url, name=stage_name, keep=False) as stage:
+ pass
+ self.check_destroy(stage, stage_name)
+
+
+ def test_keep_without_exceptions(self):
+ with Stage(archive_url, name=stage_name, keep=True) as stage:
+ pass
+ path = self.get_stage_path(stage, stage_name)
+ self.assertTrue(os.path.isdir(path))
+
+
+ def test_no_keep_with_exceptions(self):
+ try:
+ with Stage(archive_url, name=stage_name, keep=False) as stage:
+ raise Exception()
+
+ path = self.get_stage_path(stage, stage_name)
+ self.assertTrue(os.path.isdir(path))
+ except:
+ pass # ignore here.
+
+
+ def test_keep_exceptions(self):
+ try:
+ with Stage(archive_url, name=stage_name, keep=True) as stage:
+ raise Exception()
+
+ path = self.get_stage_path(stage, stage_name)
+ self.assertTrue(os.path.isdir(path))
+ except:
+ pass # ignore here.
diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py
index ed4e7c35c9..513a38ee8a 100644
--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -46,7 +46,6 @@ class Hdf5(Package):
variant('cxx', default=True, description='Enable C++ support')
variant('fortran', default=True, description='Enable Fortran support')
- variant('unsupported', default=True, description='Enables unsupported configuration options')
variant('mpi', default=False, description='Enable MPI support')
variant('szip', default=False, description='Enable szip support')
@@ -74,6 +73,13 @@ class Hdf5(Package):
self.validate(spec)
# Handle compilation after spec validation
extra_args = []
+
+ # Always enable this option. This does not actually enable any
+ # features: it only *allows* the user to specify certain
+ # combinations of other arguments. Enabling it just skips a
+ # sanity check in configure, so this doesn't merit a variant.
+ extra_args.append("--enable-unsupported")
+
if '+debug' in spec:
extra_args.append('--enable-debug=all')
else:
@@ -84,9 +90,6 @@ class Hdf5(Package):
else:
extra_args.append('--enable-static-exec')
- if '+unsupported' in spec:
- extra_args.append("--enable-unsupported")
-
if '+cxx' in spec:
extra_args.append('--enable-cxx')
diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py
index 5be187f348..efe172fc08 100644
--- a/var/spack/repos/builtin/packages/petsc/package.py
+++ b/var/spack/repos/builtin/packages/petsc/package.py
@@ -15,6 +15,7 @@ class Petsc(Package):
version('3.5.3', 'd4fd2734661e89f18ac6014b5dd1ef2f')
version('3.5.2', 'ad170802b3b058b5deb9cd1f968e7e13')
version('3.5.1', 'a557e029711ebf425544e117ffa44d8f')
+ version('3.4.4', '7edbc68aa6d8d6a3295dd5f6c2f6979d')
variant('shared', default=True, description='Enables the build of shared libraries')
variant('mpi', default=True, description='Activates MPI support')
@@ -25,21 +26,21 @@ class Petsc(Package):
variant('boost', default=True, description='Activates support for Boost')
variant('hypre', default=True, description='Activates support for Hypre')
- # Build dependencies
- depends_on('python @2.6:2.9') # requires Python for building
-
# Virtual dependencies
depends_on('blas')
depends_on('lapack')
depends_on('mpi', when='+mpi')
+ # Build dependencies
+ depends_on('python @2.6:2.7')
+
# Other dependencies
depends_on('boost', when='+boost')
depends_on('metis', when='+metis')
- depends_on('hdf5~cxx~unsupported+mpi', when='+hdf5+mpi')
+ depends_on('hdf5+mpi', when='+hdf5+mpi')
depends_on('parmetis', when='+metis+mpi')
- depends_on('hypre', when='+hypre+mpi')
+ depends_on('hypre', when='+hypre+mpi')
def mpi_dependent_options(self):
if '~mpi' in self.spec:
@@ -50,7 +51,12 @@ class Petsc(Package):
'--with-mpi=0'
]
error_message_fmt = '\t{library} support requires "+mpi" to be activated'
- errors = [error_message_fmt.format(library=x) for x in ('hdf5', 'hypre') if ('+'+x) in self.spec]
+
+ # If mpi is disabled (~mpi), it's an error to have any of these enabled.
+ # This generates a list of any such errors.
+ errors = [error_message_fmt.format(library=x)
+ for x in ('hdf5', 'hypre', 'parmetis')
+ if ('+'+x) in self.spec]
if errors:
errors = ['incompatible variants given'] + errors
raise RuntimeError('\n'.join(errors))
@@ -70,7 +76,7 @@ class Petsc(Package):
'--with-blas-lapack-dir=%s' % spec['lapack'].prefix
])
# Activates library support if needed
- for library in ('metis', 'boost', 'hfd5', 'hypre', 'parmetis'):
+ for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis'):
options.append(
'--with-{library}={value}'.format(library=library, value=('1' if library in spec else '0'))
)
@@ -79,8 +85,8 @@ class Petsc(Package):
'--with-{library}-dir={path}'.format(library=library, path=spec[library].prefix)
)
-
configure('--prefix=%s' % prefix, *options)
+
# PETSc has its own way of doing parallel make.
make('MAKE_NP=%s' % make_jobs, parallel=False)
make("install")