Fix error caused by SPACK_PATH environment variable not existing
This commit is contained in:
@@ -178,7 +178,13 @@ def default_log_file(spec):
|
|||||||
basename = fmt.format(x=spec, hash=spec.dag_hash())
|
basename = fmt.format(x=spec, hash=spec.dag_hash())
|
||||||
|
|
||||||
if spack.config.get('config:shared'):
|
if spack.config.get('config:shared'):
|
||||||
dirname = fs.os.path.join(os.environ['SPACK_PATH'],
|
if 'SPACK_PATH' in os.environ:
|
||||||
|
spack_path = os.environ['SPACK_PATH']
|
||||||
|
else:
|
||||||
|
spack_path = os.path.expanduser('~/.spack/')
|
||||||
|
|
||||||
|
if spack.config.get('config:shared'):
|
||||||
|
dirname = fs.os.path.join(spack_path,
|
||||||
'var/',
|
'var/',
|
||||||
'junit-report')
|
'junit-report')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -67,9 +67,18 @@ def get_tmp_root():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if _tmp_root is None:
|
if _tmp_root is None:
|
||||||
|
|
||||||
if spack.config.get('config:shared'):
|
if spack.config.get('config:shared'):
|
||||||
candidates = os.path.join(os.environ['SPACK_PATH'],
|
if 'SPACK_PATH' in os.environ:
|
||||||
'var/spack/stage')
|
spack_path = os.path.join(os.environ['SPACK_PATH'])
|
||||||
|
else:
|
||||||
|
spack_path = os.path.expanduser('~/.spack/')
|
||||||
|
|
||||||
|
if spack.config.get('config:shared'):
|
||||||
|
if 'SPACK_PATH' in os.environ:
|
||||||
|
candidates = os.path.join(spack_path,
|
||||||
|
'var/spack/stage')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
candidates = spack.config.get('config:build_stage')
|
candidates = spack.config.get('config:build_stage')
|
||||||
|
|
||||||
@@ -197,16 +206,24 @@ def __init__(
|
|||||||
self.name = _stage_prefix + next(tempfile._get_candidate_names())
|
self.name = _stage_prefix + next(tempfile._get_candidate_names())
|
||||||
self.mirror_path = mirror_path
|
self.mirror_path = mirror_path
|
||||||
|
|
||||||
|
# Determine SPACK_PATH variable
|
||||||
|
if spack.config.get('config:shared'):
|
||||||
|
if 'SPACK_PATH' in os.environ:
|
||||||
|
spack_path = os.path.join(os.environ['SPACK_PATH'])
|
||||||
|
else:
|
||||||
|
spack_path = os.path.expanduser('~/.spack/')
|
||||||
|
|
||||||
|
|
||||||
# Try to construct here a temporary name for the stage directory
|
# Try to construct here a temporary name for the stage directory
|
||||||
# If this is a named stage, then construct a named path.
|
# If this is a named stage, then construct a named path.
|
||||||
if path is not None:
|
if path is not None:
|
||||||
self.path = path
|
self.path = path
|
||||||
elif spack.config.get('config:shared'):
|
elif spack.config.get('config:shared'):
|
||||||
try:
|
try:
|
||||||
os.mkdir(os.environ['SPACK_PATH'] + '/var/spack/stage')
|
os.mkdir(os.path.join(spack_path, '/var/spack/stage'))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
self.path = os.path.join(os.environ['SPACK_PATH'],
|
self.path = os.path.join(spack_path,
|
||||||
'var/spack/stage/',
|
'var/spack/stage/',
|
||||||
self.name)
|
self.name)
|
||||||
else:
|
else:
|
||||||
@@ -225,7 +242,7 @@ def __init__(
|
|||||||
lock_id = prefix_bits(sha1, bit_length(sys.maxsize))
|
lock_id = prefix_bits(sha1, bit_length(sys.maxsize))
|
||||||
|
|
||||||
if spack.config.get('config:shared'):
|
if spack.config.get('config:shared'):
|
||||||
stage_lock_path = os.path.join(os.environ['SPACK_PATH'],
|
stage_lock_path = os.path.join(spack_path,
|
||||||
'var/spack/stage', '.lock')
|
'var/spack/stage', '.lock')
|
||||||
else:
|
else:
|
||||||
stage_lock_path = os.path.join(spack.paths.stage_path,
|
stage_lock_path = os.path.join(spack.paths.stage_path,
|
||||||
@@ -482,9 +499,15 @@ def create(self):
|
|||||||
spack.paths.stage_path.
|
spack.paths.stage_path.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if spack.config.get('config:shared'):
|
||||||
|
if 'SPACK_PATH' in os.environ:
|
||||||
|
spack_path = os.path.join(os.environ['SPACK_PATH'])
|
||||||
|
else:
|
||||||
|
spack_path = os.path.expanduser('~/.spack/')
|
||||||
|
|
||||||
# Create the top-level stage directory
|
# Create the top-level stage directory
|
||||||
if spack.config.get('config:shared'):
|
if spack.config.get('config:shared'):
|
||||||
mkdirp(os.path.join(os.environ['SPACK_PATH'], 'var/spack/stage'))
|
mkdirp(os.path.join(spack_path, 'var/spack/stage'))
|
||||||
else:
|
else:
|
||||||
mkdirp(spack.paths.stage_path)
|
mkdirp(spack.paths.stage_path)
|
||||||
remove_if_dead_link(self.path)
|
remove_if_dead_link(self.path)
|
||||||
|
|||||||
Reference in New Issue
Block a user