summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-08-22 01:48:54 (GMT)
committerGreg Ward <gward@python.net>2000-08-22 01:48:54 (GMT)
commit04e25a1bdfd8fd724ab46a9c946ae8aa11cd09af (patch)
tree780048593d106d3dfa973d08122831197d0d7313
parent72b93ec1c38a8fb258c2dfcee9735c820c77130b (diff)
downloadcpython-04e25a1bdfd8fd724ab46a9c946ae8aa11cd09af.zip
cpython-04e25a1bdfd8fd724ab46a9c946ae8aa11cd09af.tar.gz
cpython-04e25a1bdfd8fd724ab46a9c946ae8aa11cd09af.tar.bz2
Ensure destination directory exists before trying to create a tarball
or ZIP file.
-rw-r--r--Lib/distutils/archive_util.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/distutils/archive_util.py b/Lib/distutils/archive_util.py
index 08a3c83..26cd7fb 100644
--- a/Lib/distutils/archive_util.py
+++ b/Lib/distutils/archive_util.py
@@ -10,7 +10,7 @@ __revision__ = "$Id$"
import os
from distutils.errors import DistutilsExecError
from distutils.spawn import spawn
-
+from distutils.dir_util import mkpath
def make_tarball (base_name, base_dir, compress="gzip",
verbose=0, dry_run=0):
@@ -42,6 +42,7 @@ def make_tarball (base_name, base_dir, compress="gzip",
"bad value for 'compress': must be None, 'gzip', or 'compress'"
archive_name = base_name + ".tar"
+ mkpath(os.path.dirname(archive_name), verbose=verbose, dry_run=dry_run)
cmd = ["tar", "-cf", archive_name, base_dir]
spawn (cmd, verbose=verbose, dry_run=dry_run)
@@ -68,6 +69,7 @@ def make_zipfile (base_name, base_dir, verbose=0, dry_run=0):
# no changes needed!
zip_filename = base_name + ".zip"
+ mkpath(os.path.dirname(zip_filename), verbose=verbose, dry_run=dry_run)
try:
spawn (["zip", "-rq", zip_filename, base_dir],
verbose=verbose, dry_run=dry_run)
@@ -114,7 +116,7 @@ ARCHIVE_FORMATS = {
'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
'ztar': (make_tarball, [('compress', 'compress')], "compressed tar file"),
'tar': (make_tarball, [('compress', None)], "uncompressed tar file"),
- 'zip': (make_zipfile, [],"zip-file")
+ 'zip': (make_zipfile, [],"ZIP file")
}
def check_archive_formats (formats):