diff options
author | alalazo <massimiliano.culpo@googlemail.com> | 2016-05-10 13:37:03 +0200 |
---|---|---|
committer | alalazo <massimiliano.culpo@googlemail.com> | 2016-05-10 13:37:03 +0200 |
commit | f8f71b1c2c456210b64a90eb5b21484a8265cfa6 (patch) | |
tree | c905d5dad3b9947d4f901c407d6813d41f832dd1 | |
parent | c11a665ba15317cb391abdb8eb6c8a517e4e9b54 (diff) | |
download | spack-f8f71b1c2c456210b64a90eb5b21484a8265cfa6.tar.gz spack-f8f71b1c2c456210b64a90eb5b21484a8265cfa6.tar.bz2 spack-f8f71b1c2c456210b64a90eb5b21484a8265cfa6.tar.xz spack-f8f71b1c2c456210b64a90eb5b21484a8265cfa6.zip |
modules : prefix_inspections moved to modules.yaml
-rw-r--r-- | etc/spack/modules.yaml | 10 | ||||
-rw-r--r-- | lib/spack/spack/config.py | 8 | ||||
-rw-r--r-- | lib/spack/spack/modules.py | 18 |
3 files changed, 21 insertions, 15 deletions
diff --git a/etc/spack/modules.yaml b/etc/spack/modules.yaml index aa2a2c3fe2..8f8f88e908 100644 --- a/etc/spack/modules.yaml +++ b/etc/spack/modules.yaml @@ -5,4 +5,14 @@ # although users can override these settings in their ~/.spack/modules.yaml. # ------------------------------------------------------------------------- modules: + prefix_inspections: { + bin: ['PATH'], + man: ['MANPATH'], + lib: ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], + lib64: ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], + include: ['CPATH'], + lib/pkgconfig: ['PKGCONFIG'], + lib64/pkgconfig: ['PKGCONFIG'], + '': ['CMAKE_PREFIX_PATH'] + } enable: ['tcl', 'dotkit'] diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 64809462f9..d008a513e7 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -315,6 +315,14 @@ section_schemas = { 'default': {}, 'additionalProperties': False, 'properties': { + 'prefix_inspections': { + 'type': 'object', + 'patternProperties': { + r'\w[\w-]*': { # path to be inspected for existence (relative to prefix) + '$ref': '#/definitions/array_of_strings' + } + } + }, 'enable': { 'type': 'array', 'default': [], diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py index 57a4a2c754..f1c0bd87de 100644 --- a/lib/spack/spack/modules.py +++ b/lib/spack/spack/modules.py @@ -94,24 +94,12 @@ def inspect_path(prefix): """ env = EnvironmentModifications() # Inspect the prefix to check for the existence of common directories - prefix_inspections = { - 'bin': ('PATH',), - 'man': ('MANPATH',), - 'lib': ('LIBRARY_PATH', 'LD_LIBRARY_PATH'), - 'lib64': ('LIBRARY_PATH', 'LD_LIBRARY_PATH'), - 'include': ('CPATH',) - } - for attribute, variables in prefix_inspections.items(): - expected = getattr(prefix, attribute) + prefix_inspections = CONFIGURATION.get('prefix_inspections', {}) + for relative_path, variables in prefix_inspections.items(): + expected = join_path(prefix, relative_path) if os.path.isdir(expected): for variable in variables: env.prepend_path(variable, expected) - # PKGCONFIG - for expected in (join_path(prefix.lib, 'pkgconfig'), join_path(prefix.lib64, 'pkgconfig')): - if os.path.isdir(expected): - env.prepend_path('PKG_CONFIG_PATH', expected) - # CMake related variables - env.prepend_path('CMAKE_PREFIX_PATH', prefix) return env |