Fix spack locking on some NFS systems (#32426)
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
parent
d7d59a24d1
commit
c7292aa4b6
@ -386,8 +386,12 @@ def _ensure_parent_directory(self):
|
||||
try:
|
||||
os.makedirs(parent)
|
||||
except OSError as e:
|
||||
# makedirs can fail when diretory already exists.
|
||||
if not (e.errno == errno.EEXIST and os.path.isdir(parent) or e.errno == errno.EISDIR):
|
||||
# os.makedirs can fail in a number of ways when the directory already exists.
|
||||
# With EISDIR, we know it exists, and others like EEXIST, EACCES, and EROFS
|
||||
# are fine if we ensure that the directory exists.
|
||||
# Python 3 allows an exist_ok parameter and ignores any OSError as long as
|
||||
# the directory exists.
|
||||
if not (e.errno == errno.EISDIR or os.path.isdir(parent)):
|
||||
raise
|
||||
return parent
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user