Slightly more robust tmp directory search.
- remove getcwd() check (seems arbitrary -- if users set their TMPDIR to this why stop them?) - try a number of common locations and try per-user directories in them first.
This commit is contained in:
parent
2ba6bb21fb
commit
792b033255
@ -24,6 +24,7 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import getpass
|
||||||
from llnl.util.filesystem import *
|
from llnl.util.filesystem import *
|
||||||
|
|
||||||
# This lives in $prefix/lib/spack/spack/__file__
|
# This lives in $prefix/lib/spack/spack/__file__
|
||||||
@ -111,10 +112,17 @@
|
|||||||
# that it can create.
|
# that it can create.
|
||||||
tmp_dirs = []
|
tmp_dirs = []
|
||||||
_default_tmp = tempfile.gettempdir()
|
_default_tmp = tempfile.gettempdir()
|
||||||
if _default_tmp != os.getcwd():
|
_tmp_user = getpass.getuser()
|
||||||
tmp_dirs = [ join_path(_default_tmp, '%u', 'spack-stage'),
|
|
||||||
join_path(_default_tmp, 'spack-stage') ]
|
_tmp_candidates = (_default_tmp, '/nfs/tmp2', '/tmp', '/var/tmp')
|
||||||
tmp_dirs.append('/nfs/tmp2/%u/spack-stage') # TODO: remove
|
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
|
# Whether spack should allow installation of unsafe versions of
|
||||||
# software. "Unsafe" versions are ones it doesn't have a checksum
|
# software. "Unsafe" versions are ones it doesn't have a checksum
|
||||||
|
Loading…
Reference in New Issue
Block a user