@@ -107,9 +107,11 @@ def __init__(
107
107
distribution_prefix : str ,
108
108
strip_path_prefixes = None ,
109
109
compression = zipfile .ZIP_DEFLATED ,
110
+ force_zip64 = False ,
110
111
** kwargs ,
111
112
):
112
113
self ._distribution_prefix = distribution_prefix
114
+ self ._force_zip64 = force_zip64
113
115
114
116
self ._strip_path_prefixes = strip_path_prefixes or []
115
117
# Entries for the RECORD file as (filename, hash, size) tuples.
@@ -154,7 +156,7 @@ def arcname_from(name):
154
156
hash = hashlib .sha256 ()
155
157
size = 0
156
158
with open (real_filename , "rb" ) as fsrc :
157
- with self .open (zinfo , "w" ) as fdst :
159
+ with self .open (zinfo , "w" , force_zip64 = self . _force_zip64 ) as fdst :
158
160
while True :
159
161
block = fsrc .read (2 ** 20 )
160
162
if not block :
@@ -241,6 +243,7 @@ def __init__(
241
243
compress ,
242
244
outfile = None ,
243
245
strip_path_prefixes = None ,
246
+ force_zip64 = False ,
244
247
):
245
248
self ._name = name
246
249
self ._version = normalize_pep440 (version )
@@ -250,6 +253,7 @@ def __init__(
250
253
self ._platform = platform
251
254
self ._outfile = outfile
252
255
self ._strip_path_prefixes = strip_path_prefixes
256
+ self ._force_zip64 = force_zip64
253
257
self ._compress = compress
254
258
self ._wheelname_fragment_distribution_name = escape_filename_distribution_name (
255
259
self ._name
@@ -268,6 +272,7 @@ def __enter__(self):
268
272
distribution_prefix = self ._distribution_prefix ,
269
273
strip_path_prefixes = self ._strip_path_prefixes ,
270
274
compression = zipfile .ZIP_DEFLATED if self ._compress else zipfile .ZIP_STORED ,
275
+ force_zip64 = self ._force_zip64 ,
271
276
)
272
277
return self
273
278
@@ -478,6 +483,11 @@ def parse_args() -> argparse.Namespace:
478
483
type = Path ,
479
484
help = "Pass in the stamp info file for stamping" ,
480
485
)
486
+ output_group .add_argument (
487
+ "--force_zip64" ,
488
+ action = "store_true" ,
489
+ help = "Forces usage of zip64" ,
490
+ )
481
491
482
492
return parser .parse_args (sys .argv [1 :])
483
493
@@ -536,6 +546,7 @@ def main() -> None:
536
546
outfile = arguments .out ,
537
547
strip_path_prefixes = strip_prefixes ,
538
548
compress = not arguments .no_compress ,
549
+ force_zip64 = arguments .force_zip64 ,
539
550
) as maker :
540
551
for package_filename , real_filename in all_files :
541
552
maker .add_file (package_filename , real_filename )
0 commit comments