Skip to content

Commit 3665ddc

Browse files
bmwiedemannvstinner
authored andcommitted
bpo-36302: Sort list of sources (GH-12341)
When building packages (e.g. for openSUSE Linux) (random) filesystem order of input files influences ordering of functions in the output .so files. Thus without the patch, builds (in disposable VMs) would usually differ. Without this patch, all callers have to be patched individually ofalk/libdnet#42 sass/libsass-python#212 tahoe-lafs/pycryptopp#41 yt-project/yt#2206 pyproj4/pyproj#142 pytries/datrie#49 Roche/pyreadstat#37 but that is an infinite effort. See https://reproducible-builds.org/ for why this matters.
1 parent 850d4fa commit 3665ddc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

command/build_ext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ def build_extension(self, ext):
490490
"in 'ext_modules' option (extension '%s'), "
491491
"'sources' must be present and must be "
492492
"a list of source filenames" % ext.name)
493-
sources = list(sources)
493+
# sort to make the resulting .so file build reproducible
494+
sources = sorted(sources)
494495

495496
ext_path = self.get_ext_fullpath(ext.name)
496497
depends = sources + ext.depends

0 commit comments

Comments
 (0)