From 84521047e413d7d1150aaa1c333580b683b3f4b1 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Wed, 31 Jan 2018 11:17:10 +0100 Subject: 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. --- Lib/tarfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/tarfile.py') diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 0b8d31f85c..a24ee42abf 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -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) -- cgit v1.2.1