summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-03-18 14:40:53 +0100
committeralalazo <massimiliano.culpo@googlemail.com>2016-03-18 14:40:53 +0100
commitec8cc2b52839007f0825815c8cfdee8f9a8629a6 (patch)
treeff602c223664f79f46c18139ae6b65ad414bbefe /lib
parent82ba0c6c07406a2accc8f50e4619d5379b24aca1 (diff)
downloadspack-ec8cc2b52839007f0825815c8cfdee8f9a8629a6.tar.gz
spack-ec8cc2b52839007f0825815c8cfdee8f9a8629a6.tar.bz2
spack-ec8cc2b52839007f0825815c8cfdee8f9a8629a6.tar.xz
spack-ec8cc2b52839007f0825815c8cfdee8f9a8629a6.zip
PYTHONPATH : python patches methods for its extensions
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_environment.py4
-rw-r--r--lib/spack/spack/cmd/uninstall.py12
-rw-r--r--lib/spack/spack/directory_layout.py2
-rw-r--r--lib/spack/spack/modules.py12
-rw-r--r--lib/spack/spack/package.py10
5 files changed, 19 insertions, 21 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 68477145fe..c51fa58477 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -282,9 +282,11 @@ def setup_package(pkg):
for mod in modules:
set_module_variables_for_package(pkg, mod)
- # Allow dependencies to set up environment as well.
+ # Allow dependencies to modify the module
for dependency_spec in pkg.spec.traverse(root=False):
dependency_spec.package.modify_module(pkg.module, dependency_spec, pkg.spec)
+ # Allow dependencies to set up environment as well
+ for dependency_spec in pkg.spec.traverse(root=False):
dependency_spec.package.setup_dependent_environment(env, pkg.spec)
# TODO : implement validation
#validate(env)
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
index d01aa2136b..2fab8f6f2a 100644
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -79,7 +79,7 @@ def uninstall(parser, args):
try:
# should work if package is known to spack
pkgs.append(s.package)
- except spack.repository.UnknownPackageError, e:
+ except spack.repository.UnknownPackageError as e:
# The package.py file has gone away -- but still
# want to uninstall.
spack.Package(s).do_uninstall(force=True)
@@ -94,11 +94,11 @@ def uninstall(parser, args):
for pkg in pkgs:
try:
pkg.do_uninstall(force=args.force)
- except PackageStillNeededError, e:
+ except PackageStillNeededError as e:
tty.error("Will not uninstall %s" % e.spec.format("$_$@$%@$#", color=True))
- print
- print "The following packages depend on it:"
+ print()
+ print("The following packages depend on it:")
display_specs(e.dependents, long=True)
- print
- print "You can use spack uninstall -f to force this action."
+ print()
+ print("You can use spack uninstall -f to force this action.")
sys.exit(1)
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
index 39ee4e203d..da8f1aa1bc 100644
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -150,7 +150,7 @@ class DirectoryLayout(object):
if os.path.exists(path):
try:
shutil.rmtree(path)
- except exceptions.OSError, e:
+ except exceptions.OSError as e:
raise RemoveFailedError(spec, path, e)
path = os.path.dirname(path)
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index d192bbe004..7303844229 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -119,13 +119,13 @@ class EnvModule(object):
module_types[cls.name] = cls
def __init__(self, spec=None):
+ self.spec = spec
+ self.pkg = spec.package # Just stored for convenience
+
# category in the modules system
# TODO: come up with smarter category names.
self.category = "spack"
- self.spec = spec
- self.pkg = spec.package # Just stored for convenience
-
# short description default is just the package + version
# packages can provide this optional attribute
self.short_description = spec.format("$_ $@")
@@ -161,6 +161,12 @@ class EnvModule(object):
# Environment modifications guessed by inspecting the installation prefix
env = inspect_path(self.spec.prefix)
+
+ # Let the extendee modify their extensions before asking for package-specific modifications
+ for extendee in self.pkg.extendees:
+ extendee_spec = self.spec[extendee]
+ extendee_spec.package.modify_module(self.pkg, extendee_spec, self.spec)
+
# Package-specific environment modifications
self.spec.package.setup_environment(env)
# TODO : implement site-specific modifications and filters
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 185e3ad2ee..72c84ec624 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1261,16 +1261,6 @@ class Package(object):
"""Get the rpath args as a string, with -Wl,-rpath, for each element."""
return " ".join("-Wl,-rpath,%s" % p for p in self.rpath)
-
-class PythonExtension(Package):
- def setup_dependent_environment(self, env, dependent_spec):
- pass
-
- def setup_environment(self, env):
- site_packages = glob.glob(join_path(self.spec.prefix.lib, "python*/site-packages"))
- if site_packages:
- env.prepend_path('PYTHONPATH', site_packages[0])
-
def validate_package_url(url_string):
"""Determine whether spack can handle a particular URL or not."""
url = urlparse(url_string)