From 2c4ff3e28b846d8e7f2aca41cd875881a2711fa6 Mon Sep 17 00:00:00 2001 From: Sean Fisk Date: Wed, 5 Jul 2017 20:20:33 -0400 Subject: [PATCH] Docs: Avoid Qt re-builds by sorting set of includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because Python's set type is unordered, storing include paths in it can produce unnecessary re-builds by generating different compiler command lines between successive builds. Avoid this by using the sorted() function on the includes. The documentation for Python ≥ 2.7 guarantees that sorted() is stable, while for Python 2.5–2.6 it uses the same algorithm as list.sort(), which is stable [1]. [1]: https://stackoverflow.com/a/1915418 --- waflib/Tools/qt5.py | 2 +- waflib/extras/qt4.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/waflib/Tools/qt5.py b/waflib/Tools/qt5.py index 2c007eef..0f58095d 100644 --- a/waflib/Tools/qt5.py +++ b/waflib/Tools/qt5.py @@ -48,7 +48,7 @@ You also need to edit your sources accordingly: incs = set(self.to_list(getattr(self, 'includes', ''))) for x in self.compiled_tasks: incs.add(x.inputs[0].parent.path_from(self.path)) - self.includes = list(incs) + self.includes = sorted(incs) Note: another tool provides Qt processing that does not require .moc includes, see 'playground/slow_qt/'. diff --git a/waflib/extras/qt4.py b/waflib/extras/qt4.py index 565a4527..90cae7e0 100644 --- a/waflib/extras/qt4.py +++ b/waflib/extras/qt4.py @@ -52,7 +52,7 @@ You also need to edit your sources accordingly: incs = set(self.to_list(getattr(self, 'includes', ''))) for x in self.compiled_tasks: incs.add(x.inputs[0].parent.path_from(self.path)) - self.includes = list(incs) + self.includes = sorted(incs) Note: another tool provides Qt processing that does not require .moc includes, see 'playground/slow_qt/'.