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
This commit is contained in:
Veselin Dobrev 2023-10-30 01:36:02 -07:00 committed by GitHub
parent 6511d3dfff
commit 33cb8c988f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from platform import machine
from spack.package import * from spack.package import *
@ -74,7 +76,7 @@ def cmake_args(self):
args.append("-Denable_openmp=%s" % ("ON" if "+openmp" in spec else "OFF")) args.append("-Denable_openmp=%s" % ("ON" if "+openmp" in spec else "OFF"))
if "%cce" in spec: if "%cce" in spec:
# Assume the proper Cray CCE module (cce) is loaded: # 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.setdefault("LDFLAGS", "")
env["LDFLAGS"] += " -Wl,-rpath," + craylibs_path env["LDFLAGS"] += " -Wl,-rpath," + craylibs_path

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from platform import machine
from spack.package import * from spack.package import *
from spack.util.environment import set_env from spack.util.environment import set_env
@ -173,7 +175,7 @@ def cmake_args(self):
if "%cce" in spec: if "%cce" in spec:
# Assume the proper Cray CCE module (cce) is loaded: # 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.setdefault("LDFLAGS", "")
env["LDFLAGS"] += " -Wl,-rpath," + craylibs_path env["LDFLAGS"] += " -Wl,-rpath," + craylibs_path