Commit Graph

210 Commits

Author SHA1 Message Date
Miss Islington (bot) e4008404fb
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
(cherry picked from commit ff9147d93b)

Co-authored-by: Jan Mazur <16736821+mzr@users.noreply.github.com>
2020-09-28 12:18:39 -07:00
Miss Islington (bot) d7f37d1ed4
bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040)
(cherry picked from commit 36ff513f82)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-22 01:40:05 -07:00
Miss Islington (bot) 5c1d745da5
bpo-39830: Add zipfile.Path to __all__ (GH-19115) (GH-19116)
(cherry picked from commit 9a81ab107a)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-05-26 02:44:57 -04:00
Miss Islington (bot) 3e72de9e08
[3.8] bpo-39667: Sync zipp 3.0 (GH-18540) (GH-18701)
* bpo-39667: Sync zipp 3.0 (GH-18540)

* bpo-39667: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0

* 📜🤖 Added by blurb_it.

* Update docs for new zipfile.Path.open

* Rely on dict, faster than OrderedDict.

* Syntax edits on docs

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0aeab5c438)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

* Clarify the change in behavior with a couple of workaround options.

* Restore API compatibility while backporting performance improvements.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-04-15 14:45:25 -04:00
Miss Islington (bot) ed4d263e87
bpo-39595: Improve zipfile.Path performance (GH-18406) (GH-18472)
* Improve zipfile.Path performance on zipfiles with a large number of entries.

* 📜🤖 Added by blurb_it.

* Add bpo to blurb

* Sync with importlib_metadata 1.5 (6fe70ca)

* Update blurb.

* Remove compatibility code

* Add stubs module, omitted from earlier commit

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit e5bd73632e)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-02-11 22:21:32 -05:00
Miss Skeleton (bot) 3801b2699e
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. (GH-14656)
(cherry picked from commit da6ce58dd5)

Co-authored-by: Daniel Hillier <daniel.hillier@gmail.com>
2019-10-29 00:44:07 -07:00
Miss Skeleton (bot) 76fbdaa2a6
bpo-38334: Fix seeking backward on an encrypted zipfile.ZipExtFile. (GH-16937)
Test by Daniel Hillier.
(cherry picked from commit 5c32af7522)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-27 01:40:44 -07:00
Miss Islington (bot) 717cc61ed1
bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632)
(cherry picked from commit 2f1b857562)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2019-09-12 07:33:53 -07:00
Miss Islington (bot) c410f381bf bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)
* fix Path._add_implied_dirs to include all implied directories

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* Add tests to zipfile.Path.iterdir() fix

* Update test for zipfile.Path.iterdir()

* remove whitespace from test file

* Rewrite NEWS blurb to describe the user-facing impact and avoid implementation details.

* remove redundant [] within set comprehension

* Update to use unique_everseen to maintain order and other suggestions in review

* remove whitespace and add back add_dirs in tests

* Add new standalone function parents using posixpath to get parents of a directory

* removing whitespace (sorry)

* Remove import pathlib from zipfile.py

* Rewrite _parents as a slice on a generator of the ancestry of a path.

* Remove check for '.' and '/', now that parents no longer returns those.

* Separate calculation of implied dirs from adding those

* Re-use _implied_dirs in tests for generating zipfile with dir entries.

* Replace three fixtures (abcde, abcdef, abde) with one representative example alpharep.

* Simplify implementation of _implied_dirs by collapsing the generation of parent directories for each name.
(cherry picked from commit a4e2991bdc)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-24 12:03:52 -04:00
Miss Islington (bot) 66905d1467 bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638) (GH-14641)
* bpo-37520: Correct behavior for zipfile.Path.parent

* 📜🤖 Added by blurb_it.
(cherry picked from commit 38f44b4a4a)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-07-07 18:05:53 -04:00
Xtreak 0d70227e41 Fix typos in docs and docstrings (GH-13745) 2019-06-03 01:12:33 +02:00
Francisco Facioni ab0716ed1e bpo-22102: Fixes zip files with disks set to 0 (GH-5985) 2019-05-28 19:15:11 -04:00
Jason R. Coombs 33e067d6a2 Add support for .parent and .joinpath in zipfile.Path (#13213) 2019-05-09 11:34:35 -04:00
Jason R. Coombs b2758ff955 bpo-36832: add zipfile.Path (#13153)
* bpo-36832: add zipfile.Path

* bpo-36832: add documentation for zipfile.Path

* 📜🤖 Added by blurb_it.

* Remove module reference from blurb.

* Sort the imports

* Update docstrings and docs per recommendations.

* Rely on test.support.temp_dir

* Signal that 'root' is the parameter.

* Correct spelling of 'mod'

* Convert docstring to comment for brevity.

* Fix more errors in the docs
2019-05-08 09:45:05 -04:00
Serhiy Storchaka 2524fdefc9
bpo-36434: Properly handle writing errors in ZIP files. (GH-12559)
Errors during writing no longer prevent to properly close
the ZIP file.
2019-03-30 08:25:19 +02:00
nick sung 53c2935dac Fix typo duplicate period in a docstring in the zipfile module. (GH-12326) 2019-03-14 21:26:25 +02:00
Serhiy Storchaka 4bb186d7e2
bpo-32035: Fix words about strings and bytes in zipfile documentation. (GH-10592) 2018-11-25 09:51:14 +02:00
Silas Sewell 4ba3b50bfe bpo-34472: Add data descriptor signature to zipfile (GH-8871)
This makes streamed zips compatible with MacOS Archive Utility and
other applications.
2018-09-18 20:00:05 +03:00
Serhiy Storchaka 9bdb7be482
bpo-34341: Fix appending to ZIP archives with the ZIP64 extension. (GH-8683) 2018-09-17 15:36:40 +03:00
Marcel Plch 77b112cd56 bpo-34097: Polish API design (GH-8725)
Move strict_timestamps to constructor.
2018-08-31 16:43:31 +02:00
Marcel Plch a2fe1e52eb bpo-34097: Add support for zipping files older than 1980-01-01 (GH-8270)
ZipFile can zip files older than 1980-01-01 and newer than 2107-12-31 using
a new strict_timestamps parameter at the cost of setting the timestamp
to the limit.
2018-08-02 15:04:52 +02:00
Mickaël Schoentgen 3f8c6913b8 bpo-34035: Fix several AttributeError in zipfile seek() methods. (GH-8527) 2018-07-29 21:26:52 +03:00
Bernhard M. Wiedemann 84521047e4 bpo-30693: zip+tarfile: sort directory listing (#2263)
tarfile and zipfile now sort directory listing to generate tar and zip archives
in a more reproducible way.

See also https://reproducible-builds.org/docs/stable-inputs/ on that topic.
2018-01-31 11:17:10 +01:00
John Jolly 066df4fd45 bpo-22908: Add seek and tell functionality to ZipExtFile (GH-4966)
This allows for nested zip files, tar files within zip files, zip files within tar files, etc.

Contributed by: John Jolly
2018-01-30 00:51:35 -08:00
Bo Bayles ce237c7d58 bpo-21417: Add compresslevel= to the zipfile module (GH-5385)
This allows the compression level to be specified when writing zipfiles
(for the entire file *and* overridden on a per-file basis).

Contributed by Bo Bayles
2018-01-29 21:54:07 -08:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Serhiy Storchaka 3763ea865c Revert bpo-26293 for zipfile breakage. See also bpo-29094. (#1484) 2017-05-06 14:46:01 +03:00
Serhiy Storchaka 4c0d9ea995 bpo-30017: Allowed calling the close() method of the zip entry writer object (#1041)
multiple times.  Writing to closed zip entry writer object now always produce
a ValueError.
2017-04-12 16:03:23 +03:00
Serhiy Storchaka 150cd1916a bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944) 2017-04-07 18:56:12 +03:00
Serhiy Storchaka 06e522521c bpo-10030: Sped up reading encrypted ZIP files by 2 times. (#550) 2017-03-30 19:09:08 +03:00
Serhiy Storchaka feccdb2a24 bpo-29774: Improve error reporting for corrupted extra field in ZIP file. (#583) 2017-03-09 17:34:03 +01:00
Serhiy Storchaka 8606e9524a bpo-28231: The zipfile module now accepts path-like objects for external paths. (#511) 2017-03-08 14:37:51 +02:00
Serhiy Storchaka 67e1aa0b58 Issue #29094: Offsets in a ZIP file created with extern file object and modes
"w" and "x" now are relative to the start of the file.
2017-01-02 01:43:02 +02:00
Serhiy Storchaka e465a9af8e Issue #29094: Offsets in a ZIP file created with extern file object and modes
"w" and "x" now are relative to the start of the file.
2017-01-01 19:05:29 +02:00
Serhiy Storchaka 34cba33403 Issue #29094: Offsets in a ZIP file created with extern file object and modes
"w" and "x" now are relative to the start of the file.
2017-01-01 19:00:30 +02:00
Serhiy Storchaka 70d28a184c Remove unused imports. 2016-12-16 20:00:15 +02:00
Serhiy Storchaka 8c9331057d Issue #28115: Command-line interface of the zipfile module now uses argparse.
Added support of long options.
2016-10-23 13:32:12 +03:00
Serhiy Storchaka f068415c51 Issue #26293: Fixed writing ZIP files that starts not from the start of the
file.  Offsets in ZIP file now are relative to the start of the archive in
conforming to the specification.
2016-10-07 22:25:05 +03:00
Serhiy Storchaka 242c170f87 Issue #26293: Fixed writing ZIP files that starts not from the start of the
file.  Offsets in ZIP file now are relative to the start of the archive in
conforming to the specification.
2016-10-07 22:24:20 +03:00
Serhiy Storchaka 8793b21525 Issue #26293: Fixed writing ZIP files that starts not from the start of the
file.  Offsets in ZIP file now are relative to the start of the archive in
conforming to the specification.
2016-10-07 22:20:50 +03:00
Serhiy Storchaka 2f76b5694d Issue #28102: The zipfile module CLI now prints usage to stderr.
Patch by Stephen J. Turnbull.
2016-09-13 09:26:29 +03:00
Serhiy Storchaka b0d497c072 Issue #24693: Changed some RuntimeError's in the zipfile module to more
appropriate types. Improved some error messages and debugging output.
2016-09-10 21:28:07 +03:00
Serhiy Storchaka e670be2273 Issue #27029: Removed deprecated support of universal newlines mode from ZipFile.open(). 2016-06-11 19:32:44 +03:00
Serhiy Storchaka f47fc5553b Issue #26039: Document ZipInfo.is_dir() and make force_zip64 keyword-only.
Patch by Thomas Kluyver.
2016-05-15 12:27:16 +03:00
Serhiy Storchaka 18ee29d0b8 Issue #26039: zipfile.ZipFile.open() can now be used to write data into a ZIP
file, as well as for extracting data.  Patch by Thomas Kluyver.
2016-05-13 13:52:49 +03:00
Serhiy Storchaka 503f908090 Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir().
Patch by Thomas Kluyver.
2016-02-08 00:02:25 +02:00
Martin Panter b82032f935 Issue #22341: Drop Python 2 workaround and document CRC initial value
Also align the parameter naming in binascii to be consistent with zlib.
2015-12-11 05:19:29 +00:00
Serhiy Storchaka 6e3d2ba269 Issue #25624: ZipFile now always writes a ZIP_STORED header for directory
entries.  Patch by Dingyuan Wang.
2015-11-22 14:50:25 +02:00
Serhiy Storchaka 8bc792a602 Issue #25624: ZipFile now always writes a ZIP_STORED header for directory
entries.  Patch by Dingyuan Wang.
2015-11-22 14:49:58 +02:00
Serhiy Storchaka 9e777730eb Issue #25364: zipfile now works in threads disabled builds. 2015-10-10 19:43:32 +03:00