Commit Graph

204 Commits

Author SHA1 Message Date
Berker Peksag 2f1b857562 bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632) 2019-09-12 15:13:44 +01:00
Mickaël Schoentgen 992347d737 bpo-26185: Fix repr() on empty ZipInfo object (#13441)
* bpo-26185: Fix repr() on empty ZipInfo object

It was failing on AttributeError due to inexistant
but required attributes file_size and compress_size.
They are now initialized to 0 in ZipInfo.__init__().

* Remove useless hasattr() in ZipInfo._open_to_write()

* Completely remove file_size setting in _open_to_write().
2019-09-09 06:08:54 -07:00
shireenrao a4e2991bdc bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)
* 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.
2019-08-24 11:26:41 -04:00
Jason R. Coombs 38f44b4a4a
bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638)
* bpo-37520: Correct behavior for zipfile.Path.parent

* 📜🤖 Added by blurb_it.
2019-07-07 17:37:50 -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
Brett Cannon f299abdafa Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
2015-04-13 14:21:02 -04:00
Serhiy Storchaka 764fc9bfac Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive
creation) mode.
2015-03-25 10:09:41 +02:00
Serhiy Storchaka 77d899726f Issue #23252: Added support for writing ZIP files to unseekable streams. 2015-03-23 01:09:35 +02:00
Serhiy Storchaka 5b90f5de26 Don't seek to the start of the file when open ZipFile with the 'w' mode
(regression introduced in issue #14099).
2015-02-01 19:01:10 +02:00
Serhiy Storchaka a14f7d239f Issue #14099: Restored support of writing ZIP files to tellable but
non-seekable streams.
2015-01-26 14:01:27 +02:00
Serhiy Storchaka f15e524026 Issue #14099: Writing to ZipFile and reading multiple ZipExtFiles is
threadsafe now.
2015-01-26 13:53:38 +02:00