diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2015-12-22 07:56:10 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2015-12-22 07:56:10 -0800 |
commit | 642ee87fcc6ade1b60568ccbb70fab03b5137e1b (patch) | |
tree | 497095ee6741a96328f5ea4ceba2761a15d81c15 | |
parent | 0f6884421b200c4513a56aed5c757936dce97fd5 (diff) | |
parent | 792b03325562e5577d018b188577915ea4dd5e7d (diff) | |
download | spack-642ee87fcc6ade1b60568ccbb70fab03b5137e1b.tar.gz spack-642ee87fcc6ade1b60568ccbb70fab03b5137e1b.tar.bz2 spack-642ee87fcc6ade1b60568ccbb70fab03b5137e1b.tar.xz spack-642ee87fcc6ade1b60568ccbb70fab03b5137e1b.zip |
Merge branch 'nolta-249' into develop
-rw-r--r-- | lib/spack/spack/__init__.py | 15 |
1 files changed, 12 insertions, 3 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 |