mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
8d83e4ba78
commit
84521047e4
7 changed files with 39 additions and 6 deletions
|
@ -1943,7 +1943,7 @@ class TarFile(object):
|
|||
elif tarinfo.isdir():
|
||||
self.addfile(tarinfo)
|
||||
if recursive:
|
||||
for f in os.listdir(name):
|
||||
for f in sorted(os.listdir(name)):
|
||||
self.add(os.path.join(name, f), os.path.join(arcname, f),
|
||||
recursive, filter=filter)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue