Source: python-qt4
Version: 4.11.3+dfsg-2
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-CC: reproducible-builds@lists.alioth.debian.org

Hi!

While working on Debian's “reproducible builds” effort [1], we have
noticed that pyuic doesn't sort the order of imported modules in
generated UI files.
The attached patch fixes this.

An example of an affected package is eric [2].

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
[2]: https://reproducible.debian.net/rb-pkg/unstable/amd64/eric.html

diff --git a/debian/patches/series b/debian/patches/series
index a89a1d2..b90258d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ debian_configure_changes.diff
 qreal_float_support.diff
 config_flags.diff
 remove_timestamps.diff
+sort_imports.diff
diff --git a/debian/patches/sort_imports.diff b/debian/patches/sort_imports.diff
new file mode 100644
index 0000000..ae80e1e
--- /dev/null
+++ b/debian/patches/sort_imports.diff
@@ -0,0 +1,31 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: sort imported modules to get reproducible output
+
+Index: python-qt4-4.11.3+dfsg/pyuic/uic/Compiler/compiler.py
+===================================================================
+--- python-qt4-4.11.3+dfsg.orig/pyuic/uic/Compiler/compiler.py
++++ python-qt4-4.11.3+dfsg/pyuic/uic/Compiler/compiler.py
+@@ -143,7 +143,7 @@ class UICompiler(UIParser):
+ 
+         self.factory._cpolicy._writeOutImports()
+ 
+-        for res in self._resources:
++        for res in sorted(self._resources):
+             write_import(res, from_imports)
+ 
+         return {"widgetname": str(w),
+Index: python-qt4-4.11.3+dfsg/pyuic/uic/Compiler/qobjectcreator.py
+===================================================================
+--- python-qt4-4.11.3+dfsg.orig/pyuic/uic/Compiler/qobjectcreator.py
++++ python-qt4-4.11.3+dfsg/pyuic/uic/Compiler/qobjectcreator.py
+@@ -130,8 +130,8 @@ class _CustomWidgetLoader(object):
+             _, module = self._widgets[widget]
+             imports.setdefault(module, []).append(widget)
+ 
+-        for module, classes in imports.items():
+-            write_code("from %s import %s" % (module, ", ".join(classes)))
++        for module, classes in sorted(imports.items()):
++            write_code("from %s import %s" % (module, ", ".join(sorted(classes))))
+ 
+ 
+ class CompilerCreatorPolicy(object):

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to