File reproducible.patch of Package python

commit 7d0d2704917eec3e9757f84dcd27aeaafdfe03cf
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date:   Mon Jun 5 17:33:33 2017 +0200

    bpo-36302: Sort list of sources
    
    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
    https://github.com/dugsong/libdnet/pull/42
    https://github.com/sass/libsass-python/pull/212
    https://github.com/tahoe-lafs/pycryptopp/pull/41
    https://github.com/yt-project/yt/pull/2206
    https://github.com/pyproj4/pyproj/pull/142
    https://github.com/pytries/datrie/pull/49
    https://github.com/Roche/pyreadstat/pull/37
    but that is an infinite effort.
    
    See https://reproducible-builds.org/ for why this matters.

diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index cf37d28d1d..cd4ab68a8d 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -455,7 +455,7 @@ class build_ext (Command):
                   ("in 'ext_modules' option (extension '%s'), " +
                    "'sources' must be present and must be " +
                    "a list of source filenames") % ext.name
-        sources = list(sources)
+        sources = sorted(sources)
 
         ext_path = self.get_ext_fullpath(ext.name)
         depends = sources + ext.depends


commit 6f003015e2f169c40d4960e4a7e28879cfdc2262
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date:   Thu Aug 3 06:11:42 2017 +0200

    Sort file list
    
    that is generated by the record option
    to generate a reproducible crmsh package's
    /usr/lib/python2.7/site-packages/crmsh/install_files.txt
    that does not differ depending on (random) filesystem order
    
    See https://reproducible-builds.org/ for why this matters.

diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index b9f1c6c566..1fede26850 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -630,7 +630,7 @@ class install (Command):
             outputs.append(os.path.join(self.install_libbase,
                                         self.path_file + ".pth"))
 
-        return outputs
+        return outputs
 
     def get_inputs (self):
         # XXX gee, this looks familiar ;-(
diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py
index 043e8b6e27..13cd653890 100644
--- a/Lib/distutils/command/install_lib.py
+++ b/Lib/distutils/command/install_lib.py
@@ -198,7 +198,7 @@ class install_lib(Command):
                                  'build_ext', 'build_lib',
                                  self.install_dir)
 
-        return pure_outputs + bytecode_outputs + ext_outputs
+        return pure_outputs + bytecode_outputs + ext_outputs
 
     def get_inputs(self):
         """Get the list of files that are input to this command, ie. the