From 2f4d8a634d19debbe069f3c44b4d2d6822f693cb Mon Sep 17 00:00:00 2001 From: Elizabeth F Date: Sun, 3 Apr 2016 15:45:09 -0400 Subject: [PATCH] Fix conditional extends (BUG #683) --- lib/spack/spack/modules.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py index f6a11c92e3..d797af287d 100644 --- a/lib/spack/spack/modules.py +++ b/lib/spack/spack/modules.py @@ -163,9 +163,14 @@ def write(self): # package-specific modifications spack_env = EnvironmentModifications() for item in self.pkg.extendees: - package = self.spec[item].package - package.setup_dependent_package(self.pkg.module, self.spec) - package.setup_dependent_environment(spack_env, env, self.spec) + try: + package = self.spec[item].package + package.setup_dependent_package(self.pkg.module, self.spec) + package.setup_dependent_environment(spack_env, env, self.spec) + except: + # The extends was conditional, so it doesn't count here + # eg: extends('python', when='+python') + pass # Package-specific environment modifications self.spec.package.setup_environment(spack_env, env)