diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -467,6 +467,7 @@ - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - *tar*: uncompressed tar file - *zip*: ZIP file + - *zip64*: ZIP64 file You can register new formats or provide your own archiver for any existing formats, by using :func:`register_archive_format`. @@ -537,6 +538,7 @@ - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - *tar*: uncompressed tar file - *zip*: ZIP file + - *zip64*: ZIP64 file You can register new formats or provide your own unpacker for any existing formats, by using :func:`register_unpack_format`. diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -646,7 +646,8 @@ "could neither import the 'zipfile' module nor " "find a standalone zip utility") % zip_filename -def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): +def _make_zipfile(base_name, base_dir, zip64=False, verbose=0, dry_run=0, + logger=None): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the @@ -680,7 +681,8 @@ if not dry_run: zip = zipfile.ZipFile(zip_filename, "w", - compression=zipfile.ZIP_DEFLATED) + compression=zipfile.ZIP_DEFLATED, + allowZip64=zip64) for dirpath, dirnames, filenames in os.walk(base_dir): for name in filenames: @@ -696,7 +698,8 @@ _ARCHIVE_FORMATS = { 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [], "ZIP file") + 'zip': (_make_zipfile, [('zip64', False)], "ZIP file"), + 'zip64': (_make_zipfile, [('zip64', True)], "ZIP64 file") } if _BZ2_SUPPORTED: @@ -777,7 +780,7 @@ for arg, val in format_info[1]: kwargs[arg] = val - if format != 'zip': + if func != _make_zipfile: kwargs['owner'] = owner kwargs['group'] = group diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1046,6 +1046,13 @@ res = make_archive(base_name, 'zip', root_dir, base_dir) self.assertTrue(os.path.exists(res)) + res = make_archive(base_name, 'zip64', root_dir, base_dir, + owner=owner, group=group) + self.assertTrue(os.path.exists(res)) + + res = make_archive(base_name, 'zip64', root_dir, base_dir) + self.assertTrue(os.path.exists(res)) + res = make_archive(base_name, 'tar', root_dir, base_dir, owner=owner, group=group) self.assertTrue(os.path.exists(res)) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -755,6 +755,7 @@ Steve Majewski Grzegorz Makarewicz David Malcolm +William Mallard Ken Manheimer Vladimir Marangozov Colin Marc