From 33cb8c988f3fd9afb364b403eda3aaaabe130729 Mon Sep 17 00:00:00 2001 From: Veselin Dobrev Date: Mon, 30 Oct 2023 01:36:02 -0700 Subject: Fix an issue with using the environment variable `MACHTYPE` which is not always defined (#40733) * Fix an issue reported here: https://github.com/spack/spack/pull/36154#issuecomment-1781854894 * [@spackbot] updating style on behalf of v-dobrev --- var/spack/repos/builtin/packages/butterflypack/package.py | 4 +++- var/spack/repos/builtin/packages/strumpack/package.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/butterflypack/package.py b/var/spack/repos/builtin/packages/butterflypack/package.py index 848dbcdfeb..c9726a52aa 100644 --- a/var/spack/repos/builtin/packages/butterflypack/package.py +++ b/var/spack/repos/builtin/packages/butterflypack/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from platform import machine + from spack.package import * @@ -74,7 +76,7 @@ class Butterflypack(CMakePackage): args.append("-Denable_openmp=%s" % ("ON" if "+openmp" in spec else "OFF")) if "%cce" in spec: # Assume the proper Cray CCE module (cce) is loaded: - craylibs_path = env["CRAYLIBS_" + env["MACHTYPE"].capitalize()] + craylibs_path = env["CRAYLIBS_" + machine().upper()] env.setdefault("LDFLAGS", "") env["LDFLAGS"] += " -Wl,-rpath," + craylibs_path diff --git a/var/spack/repos/builtin/packages/strumpack/package.py b/var/spack/repos/builtin/packages/strumpack/package.py index fce0c4cd17..a82b3784b4 100644 --- a/var/spack/repos/builtin/packages/strumpack/package.py +++ b/var/spack/repos/builtin/packages/strumpack/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from platform import machine + from spack.package import * from spack.util.environment import set_env @@ -173,7 +175,7 @@ class Strumpack(CMakePackage, CudaPackage, ROCmPackage): if "%cce" in spec: # Assume the proper Cray CCE module (cce) is loaded: - craylibs_path = env["CRAYLIBS_" + env["MACHTYPE"].capitalize()] + craylibs_path = env["CRAYLIBS_" + machine().upper()] env.setdefault("LDFLAGS", "") env["LDFLAGS"] += " -Wl,-rpath," + craylibs_path -- cgit v1.2.3-60-g2f50