summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-01-24 16:16:43 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-01-24 16:16:43 -0800
commitbe354e85c9d168b5764f8fec6cd1da53a5b4a7fe (patch)
tree6f40d30f24f94d5883ba62a2407e2988e9723e2c
parent64a954922504d08d2e109ae93be06c5095243b67 (diff)
downloadspack-be354e85c9d168b5764f8fec6cd1da53a5b4a7fe.tar.gz
spack-be354e85c9d168b5764f8fec6cd1da53a5b4a7fe.tar.bz2
spack-be354e85c9d168b5764f8fec6cd1da53a5b4a7fe.tar.xz
spack-be354e85c9d168b5764f8fec6cd1da53a5b4a7fe.zip
Better errors for mkdirp failure in mirror.
-rw-r--r--lib/spack/spack/mirror.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py
index 1d9b0e7ef2..d4f1bb89fe 100644
--- a/lib/spack/spack/mirror.py
+++ b/lib/spack/spack/mirror.py
@@ -147,7 +147,11 @@ def create(path, specs, **kwargs):
# Get the absolute path of the root before we start jumping around.
mirror_root = os.path.abspath(path)
if not os.path.isdir(mirror_root):
- mkdirp(mirror_root)
+ try:
+ mkdirp(mirror_root)
+ except OSError as e:
+ raise MirrorError(
+ "Cannot create directory '%s':" % mirror_root, str(e))
# Things to keep track of while parsing specs.
present = []
@@ -164,7 +168,11 @@ def create(path, specs, **kwargs):
# create a subdirectory for the current package@version
archive_path = os.path.abspath(join_path(mirror_root, mirror_archive_path(spec)))
subdir = os.path.dirname(archive_path)
- mkdirp(subdir)
+ try:
+ mkdirp(subdir)
+ except OSError as e:
+ raise MirrorError(
+ "Cannot create directory '%s':" % subdir, str(e))
if os.path.exists(archive_path):
tty.msg("Already added %s" % spec.format("$_$@"))