diff options
author | John W. Parent <45471568+johnwparent@users.noreply.github.com> | 2023-05-10 18:12:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 18:12:58 -0400 |
commit | ec800cccbb85bca59b405622017cb9b0b74c7cfe (patch) | |
tree | bcacd0e027c7cbe3dbf2c959f81e821c7a1a5dbe | |
parent | 85cc9097cb10227fcb967e5620f07236006b80c3 (diff) | |
download | spack-ec800cccbb85bca59b405622017cb9b0b74c7cfe.tar.gz spack-ec800cccbb85bca59b405622017cb9b0b74c7cfe.tar.bz2 spack-ec800cccbb85bca59b405622017cb9b0b74c7cfe.tar.xz spack-ec800cccbb85bca59b405622017cb9b0b74c7cfe.zip |
Windows: Fix external detection for service accounts (#37293)
Prior to this PR, the HOMEDRIVE environment variable was used to
detect what drive we are operating in. This variable is not available
for service account logins (like what is used for CI), so switch to
extracting the drive from PROGRAMFILES (which is more-widely defined).
-rw-r--r-- | lib/spack/spack/detection/common.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/spack/spack/detection/common.py b/lib/spack/spack/detection/common.py index 8cb9d7d3ac..3e9856766f 100644 --- a/lib/spack/spack/detection/common.py +++ b/lib/spack/spack/detection/common.py @@ -218,8 +218,10 @@ def update_configuration(detected_packages, scope=None, buildable=True): def _windows_drive(): - """Return Windows drive string""" - return os.environ["HOMEDRIVE"] + """Return Windows drive string extracted from PROGRAMFILES + env var, which is garunteed to be defined for all logins""" + drive = re.match(r"([a-zA-Z]:)", os.environ["PROGRAMFILES"]).group(1) + return drive class WindowsCompilerExternalPaths(object): |