summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/__init__.py15
-rw-r--r--lib/spack/spack/build_environment.py2
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 02eeed01fa..92cb417a85 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -24,6 +24,7 @@
##############################################################################
import os
import tempfile
+import getpass
from llnl.util.filesystem import *
# This lives in $prefix/lib/spack/spack/__file__
@@ -111,9 +112,17 @@ use_tmp_stage = True
# that it can create.
tmp_dirs = []
_default_tmp = tempfile.gettempdir()
-if _default_tmp != os.getcwd():
- tmp_dirs.append(os.path.join(_default_tmp, 'spack-stage'))
-tmp_dirs.append('/nfs/tmp2/%u/spack-stage')
+_tmp_user = getpass.getuser()
+
+_tmp_candidates = (_default_tmp, '/nfs/tmp2', '/tmp', '/var/tmp')
+for path in _tmp_candidates:
+ # don't add a second username if it's already unique by user.
+ if not _tmp_user in path:
+ tmp_dirs.append(join_path(path, '%u', 'spack-stage'))
+
+for path in _tmp_candidates:
+ if not path in tmp_dirs:
+ tmp_dirs.append(join_path(path, 'spack-stage'))
# Whether spack should allow installation of unsafe versions of
# software. "Unsafe" versions are ones it doesn't have a checksum
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 20154a55b3..84c2f6015b 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -145,7 +145,7 @@ def set_build_environment_variables(pkg):
# Install root prefix
os.environ[SPACK_INSTALL] = spack.install_path
- # Remove these vars from the environment during build becaus they
+ # Remove these vars from the environment during build because they
# can affect how some packages find libraries. We want to make
# sure that builds never pull in unintended external dependencies.
pop_keys(os.environ, "LD_LIBRARY_PATH", "LD_RUN_PATH", "DYLD_LIBRARY_PATH")