From a20ba315f57bcbbb73838d1b67a15a9e14d580cd Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 19 Jun 2020 12:31:09 -0700 Subject: [PATCH] Axom/Conduit: Fix error when fortran is not defined (#17171) * Fix error when fortran is not defined * Guard more ~fortran cases --- var/spack/repos/builtin/packages/axom/package.py | 8 +++++--- var/spack/repos/builtin/packages/conduit/package.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/axom/package.py b/var/spack/repos/builtin/packages/axom/package.py index 2eb3ae226c9..add0619a3e8 100644 --- a/var/spack/repos/builtin/packages/axom/package.py +++ b/var/spack/repos/builtin/packages/axom/package.py @@ -231,7 +231,9 @@ def hostconfig(self, spec, prefix): if fflags: cfg.write(cmake_cache_entry("CMAKE_Fortran_FLAGS", fflags)) - if ("gfortran" in f_compiler) and ("clang" in cpp_compiler): + if ((f_compiler is not None) + and ("gfortran" in f_compiler) + and ("clang" in cpp_compiler)): libdir = pjoin(os.path.dirname( os.path.dirname(cpp_compiler)), "lib") flags = "" @@ -444,7 +446,7 @@ def hostconfig(self, spec, prefix): # Override XL compiler family familymsg = ("Override to proper compiler family for XL") - if "xlf" in f_compiler: + if (f_compiler is not None) and ("xlf" in f_compiler): cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER_ID", "XL", familymsg)) if "xlc" in c_compiler: @@ -455,7 +457,7 @@ def hostconfig(self, spec, prefix): familymsg)) if spec.satisfies('target=ppc64le:'): - if "xlf" in f_compiler: + if (f_compiler is not None) and ("xlf" in f_compiler): description = ("Converts C-style comments to Fortran style " "in preprocessed files") cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS", diff --git a/var/spack/repos/builtin/packages/conduit/package.py b/var/spack/repos/builtin/packages/conduit/package.py index 9928884e924..b8b23bccbee 100644 --- a/var/spack/repos/builtin/packages/conduit/package.py +++ b/var/spack/repos/builtin/packages/conduit/package.py @@ -371,7 +371,9 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): if fflags: cfg.write(cmake_cache_entry("CMAKE_Fortran_FLAGS", fflags)) - if ("gfortran" in f_compiler) and ("clang" in cpp_compiler): + if ((f_compiler is not None) + and ("gfortran" in f_compiler) + and ("clang" in cpp_compiler)): libdir = os.path.join(os.path.dirname( os.path.dirname(f_compiler)), "lib") flags = ""