summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-08-22 01:48:54 +0000
committerGreg Ward <gward@python.net>2000-08-22 01:48:54 +0000
commit4f5e1e585c63192aba747f7e0a096c1dc80a5fef (patch)
tree08227dd253c13f1f88017e84f374970c9d300d94 /Lib
parent9d6d3ed859e038cb2eebd6cd787aaede99a098f3 (diff)
downloadcpython-4f5e1e585c63192aba747f7e0a096c1dc80a5fef.tar.gz
Ensure destination directory exists before trying to create a tarball
or ZIP file.
Diffstat (limited to 'Lib')
-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 08a3c8310c..26cd7fb2ec 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):