Skip to content

Commit

Permalink
bpo-36302: Sort list of sources (pythonGH-12341)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bmwiedemann authored and lisroach committed Sep 9, 2019
1 parent 3216152 commit 8134762
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ def build_extension(self, ext):
"in 'ext_modules' option (extension '%s'), "
"'sources' must be present and must be "
"a list of source filenames" % ext.name)
sources = list(sources)
# sort to make the resulting .so file build reproducible
sources = sorted(sources)

ext_path = self.get_ext_fullpath(ext.name)
depends = sources + ext.depends
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distutils sorts source file lists so that Extension .so files
build more reproducibly by default

0 comments on commit 8134762

Please sign in to comment.