Merge branch 'features/python-modules' into features/memaxes
Conflicts: var/spack/packages/qt/package.py
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -109,12 +109,17 @@ def path_for_spec(self, spec):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    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 @@ def __init__(self, installed_spec, new_spec):
 | 
			
		||||
            % 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 @@ def __init__(self, spec, extension_spec):
 | 
			
		||||
        super(NoSuchExtensionError, self).__init__(
 | 
			
		||||
            "%s cannot be removed from %s because it's not installed."% (
 | 
			
		||||
                extension_spec.short_spec, spec.short_spec))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -829,11 +829,6 @@ def do_install(self, **kwargs):
 | 
			
		||||
                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 @@ def module(self):
 | 
			
		||||
                          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 @@ def setup_extension_environment(self, module, spec, ext_spec):
 | 
			
		||||
           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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user