From b668c95fe9119885298b5c76f925edf2c84f8f3c Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Mon, 29 Jan 2024 12:47:02 +0100 Subject: [PATCH] Sort glob output Similar to C, bash, perl, ruby, make See https://reproducible-builds.org/ for why this is good. This patch was done while working on reproducible builds for openSUSE. --- Lib/glob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/glob.py b/Lib/glob.py index a7256422d520fb6..97b76f0b6777553 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -25,7 +25,7 @@ def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, If `recursive` is true, the pattern '**' will match any files and zero or more directories and subdirectories. """ - return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive, + return sorted(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive, include_hidden=include_hidden)) def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False,