diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_environment.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/cmd/clean.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/cmd/extensions.py | 9 | ||||
-rw-r--r-- | lib/spack/spack/directory_layout.py | 20 | ||||
-rw-r--r-- | lib/spack/spack/hooks/extensions.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 11 |
6 files changed, 35 insertions, 19 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 70b5c89411..5e8c52cb3c 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -221,3 +221,8 @@ def setup_package(pkg): set_compiler_environment_variables(pkg) set_build_environment_variables(pkg) set_module_variables_for_package(pkg) + + # Allow dependencies to set up environment as well. + for dep_spec in pkg.spec.traverse(root=False): + dep_spec.package.setup_dependent_environment( + pkg.module, dep_spec, pkg.spec) diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py index 79dd91c5bf..ec3b221988 100644 --- a/lib/spack/spack/cmd/clean.py +++ b/lib/spack/spack/cmd/clean.py @@ -23,6 +23,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from external import argparse +import subprocess import llnl.util.tty as tty diff --git a/lib/spack/spack/cmd/extensions.py b/lib/spack/spack/cmd/extensions.py index f6ccd7b515..ae73d8ac55 100644 --- a/lib/spack/spack/cmd/extensions.py +++ b/lib/spack/spack/cmd/extensions.py @@ -75,14 +75,15 @@ def extensions(parser, args): if not extensions: tty.msg("%s has no extensions." % spec.cshort_spec) return - tty.msg("%s extensions:" % spec.cshort_spec) + tty.msg(spec.cshort_spec) + tty.msg("%d extensions:" % len(extensions)) colify(ext.name for ext in extensions) # List specs of installed extensions. installed = [s.spec for s in spack.db.installed_extensions_for(spec)] print if not installed: - tty.msg("None activated.") + tty.msg("None installed.") return tty.msg("%d installed:" % len(installed)) spack.cmd.find.display_specs(installed, mode=args.mode) @@ -93,5 +94,5 @@ def extensions(parser, args): if not activated: tty.msg("None activated.") return - tty.msg("%d currently activated:" % len(exts)) - spack.cmd.find.display_specs(installed, mode=args.mode) + tty.msg("%d currently activated:" % len(activated)) + spack.cmd.find.display_specs(activated, mode=args.mode) diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index efc40a17a4..37740720a2 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -109,12 +109,17 @@ class DirectoryLayout(object): def remove_path_for_spec(self, spec): - """Removes a prefix and any empty parent directories from the root.""" + """Removes a prefix and any empty parent directories from the root. + Raised RemoveFailedError if something goes wrong. + """ path = self.path_for_spec(spec) assert(path.startswith(self.root)) if os.path.exists(path): - shutil.rmtree(path, True) + try: + shutil.rmtree(path) + except exceptions.OSError, e: + raise RemoveFailedError(spec, path, e) path = os.path.dirname(path) while path != self.root: @@ -330,6 +335,15 @@ class SpecHashCollisionError(DirectoryLayoutError): % installed_spec, new_spec) +class RemoveFailedError(DirectoryLayoutError): + """Raised when a DirectoryLayout cannot remove an install prefix.""" + def __init__(self, installed_spec, prefix, error): + super(RemoveFailedError, self).__init__( + 'Could not remove prefix %s for %s : %s' + % prefix, installed_spec.short_spec, error) + self.cause = error + + class InconsistentInstallDirectoryError(DirectoryLayoutError): """Raised when a package seems to be installed to the wrong place.""" def __init__(self, message): @@ -370,3 +384,5 @@ class NoSuchExtensionError(DirectoryLayoutError): super(NoSuchExtensionError, self).__init__( "%s cannot be removed from %s because it's not installed."% ( extension_spec.short_spec, spec.short_spec)) + + diff --git a/lib/spack/spack/hooks/extensions.py b/lib/spack/spack/hooks/extensions.py index 718b24b965..9d6fa23d03 100644 --- a/lib/spack/spack/hooks/extensions.py +++ b/lib/spack/spack/hooks/extensions.py @@ -26,15 +26,11 @@ import spack -def post_install(pkg): - if pkg.is_extension: - pkg.do_activate() - - def pre_uninstall(pkg): # Need to do this b/c uninstall does not automatically do it. # TODO: store full graph info in stored .spec file. pkg.spec.normalize() if pkg.is_extension: - pkg.do_deactivate() + if pkg.activated: + pkg.do_deactivate() diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index b905968540..b18d054990 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -829,11 +829,6 @@ class Package(object): self.stage.chdir_to_source() build_env.setup_package(self) - # Allow extendees to further set up the environment. - if self.is_extension: - self.extendee_spec.package.setup_extension_environment( - self.module, self.extendee_spec, self.spec) - if fake_install: self.do_fake_install() else: @@ -910,8 +905,8 @@ class Package(object): fromlist=[self.__class__.__name__]) - def setup_extension_environment(self, module, spec, ext_spec): - """Called before the install() method of extensions. + def setup_dependent_environment(self, module, spec, dependent_spec): + """Called before the install() method of dependents. Default implementation does nothing, but this can be overridden by an extendable package to set up the install @@ -930,6 +925,8 @@ class Package(object): put a 'python' Execuable object in the module scope for the extension package to simplify extension installs. + 3. A lot of Qt extensions need QTDIR set. This can be used to do that. + """ pass |