summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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("$_$@"))