summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorWouter Deconinck <wdconinc@gmail.com>2023-12-17 12:17:23 -0600
committerGitHub <noreply@github.com>2023-12-17 12:17:23 -0600
commitb111064e221aae83e62226672cd8bf9a7524423d (patch)
tree3faf5f5517ae6f73aef0494773d16641f155ee9e /var
parent17d47accf90b6a33f4da83767caf35cb7f6b290d (diff)
downloadspack-b111064e221aae83e62226672cd8bf9a7524423d.tar.gz
spack-b111064e221aae83e62226672cd8bf9a7524423d.tar.bz2
spack-b111064e221aae83e62226672cd8bf9a7524423d.tar.xz
spack-b111064e221aae83e62226672cd8bf9a7524423d.zip
py-htgettoken: use os.environ, avoid AttributeError (#41717)
* py-htgettoken: use os.environ, avoid AttributeError This avoids the following error: ``` Warning: could not load runtime environment due to AttributeError: 'EnvironmentModifications' object has no attribute 'get' ``` * py-htgettoken: allow for undefined variables * py-htgettoken: use dict get() Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com> --------- Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-htgettoken/package.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/py-htgettoken/package.py b/var/spack/repos/builtin/packages/py-htgettoken/package.py
index 4ddc0c25bd..bbaeb959fa 100644
--- a/var/spack/repos/builtin/packages/py-htgettoken/package.py
+++ b/var/spack/repos/builtin/packages/py-htgettoken/package.py
@@ -33,8 +33,8 @@ class PyHtgettoken(PythonPackage):
depends_on("py-urllib3", type=("build", "run"))
def setup_run_environment(self, env):
- dir = env.get("XDG_RUNTIME_DIR") or "/tmp"
- uid = env.get("UID") or os.geteuid()
+ dir = os.environ.get("XDG_RUNTIME_DIR", "/tmp")
+ uid = os.environ.get("UID", str(os.geteuid()))
file = join_path(dir, "bt_u" + uid)
env.set("BEARER_TOKEN", file)
env.set("BEARER_TOKEN_FILE", file)