diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2015-01-06 14:49:13 -0500 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2015-02-02 11:16:23 -0800 |
commit | ebe0c1d83ac1380a6320a8dadcfa2ad4fc07c279 (patch) | |
tree | 18c2722e442d453bf39922e335cab310e6dc1cc7 | |
parent | 88afad3e46326c56aaeaed6adc2058033ad7ad33 (diff) | |
download | spack-ebe0c1d83ac1380a6320a8dadcfa2ad4fc07c279.tar.gz spack-ebe0c1d83ac1380a6320a8dadcfa2ad4fc07c279.tar.bz2 spack-ebe0c1d83ac1380a6320a8dadcfa2ad4fc07c279.tar.xz spack-ebe0c1d83ac1380a6320a8dadcfa2ad4fc07c279.zip |
New "extends" relation adds another special list to the package class.
-rw-r--r-- | lib/spack/spack/package.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/relations.py | 26 |
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 1dfd3d1c83..c256ea479f 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -314,6 +314,9 @@ class Package(object): """Specs of virtual packages provided by this package, keyed by name.""" provided = {} + """Specs of packages this one extends, keyed by name.""" + extendees = {} + """Specs of conflicting packages, keyed by name. """ conflicted = {} diff --git a/lib/spack/spack/relations.py b/lib/spack/spack/relations.py index b1f4348945..aaca9c199e 100644 --- a/lib/spack/spack/relations.py +++ b/lib/spack/spack/relations.py @@ -107,8 +107,9 @@ def depends_on(*specs): """Adds a dependencies local variable in the locals of the calling class, based on args. """ pkg = get_calling_package_name() + clocals = caller_locals() + dependencies = clocals.setdefault('dependencies', {}) - dependencies = caller_locals().setdefault('dependencies', {}) for string in specs: for spec in spack.spec.parse(string): if pkg == spec.name: @@ -116,6 +117,29 @@ def depends_on(*specs): dependencies[spec.name] = spec +def extends(*specs): + """Same as depends_on, but dependency is symlinked into parent prefix. + + This is for Python and other language modules where the module + needs to be installed into the prefix of the Python installation. + Spack handles this by installing modules into their own prefix, + but allowing ONE module version to be symlinked into a parent + Python install at a time. + + """ + pkg = get_calling_package_name() + clocals = caller_locals() + dependencies = clocals.setdefault('dependencies', {}) + extendees = clocals.setdefault('extendees', {}) + + for string in specs: + for spec in spack.spec.parse(string): + if pkg == spec.name: + raise CircularReferenceError('depends_on', pkg) + dependencies[spec.name] = spec + extendees[spec.name] = spec + + def provides(*specs, **kwargs): """Allows packages to provide a virtual dependency. If a package provides 'mpi', other packages can declare that they depend on "mpi", and spack |