Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2015-10-03 19:37:50 +0300
committerMikkel Krautz <mikkel@krautz.dk>2015-10-13 21:44:57 +0300
commita5009b64bed0514af3040aa98e3f22c74573d53b (patch)
treeb7bf35b882884f4e96eba612618abdbe753fc1f0 /scripts/rcc-depends.py
parent495dfdc099df57470b2985d8aad1014791cbb23f (diff)
Fix "RCC: Error in [...]" output that appears when running qmake.
This change removes the "RCC Error:" output that appears when running "qmake -recursive main.pro". The qmake tool's resources feature (resources.prf) invokes "rcc -list <input>.qrc" to determine which files to add as dependencies for the rcc target (for the given <input>.qrc) in the generated Makefile. When invoking "rcc -list [...]" on some of our .qrc files, we get errors, such as: RCC: Error in 'mumble.qrc': Cannot find file 'mumble_cs.qm' RCC: Error in 'mumble.qrc': Cannot find file 'mumble_da.qm' RCC: Error in 'mumble.qrc': Cannot find file 'mumble_de.qm' [...] This is because our .qrc files include references to files that are generated when we invoke the Makefile. Unfortunately, the invocation of "rcc -list [...]" happens during the qmake invocation, and not when running "make". So the files simply do not exist yet. This change replaces the qmake "rcc" extra compiler's "depend_command" to be a script we wrote ourselves, namely rcc-depends.py, that lives in the scripts directory. This script does practically the same thing as invoking "rcc -list", but it does not care if the files exist yet or not. It expects that they do. The result is that all files listed in a .qrc file are now properly added as dependencies for the Makefile rule that invokes rcc to process the .qrc file. This did not happen before. So, a positive side-effect of this change is that our Makefile is now able to order things correctly itself, even for auto-generated files in .qrc files. Before, we had to give it hints. These hints are still in place, such as: lrel.variable_out = rcc.depends and copytrans.variable_out = rcc.depends both from mumble.pro. These hints are used to order the lrel and copytrans targets before rcc is invoked in the generated Makefile. However, now that all files are output as dependency information in the Makefile, this should not strictly be necessary. This change has been tested with both Qt 4 and Qt 5, on Windows and Linux.
Diffstat (limited to 'scripts/rcc-depends.py')
-rwxr-xr-xscripts/rcc-depends.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/scripts/rcc-depends.py b/scripts/rcc-depends.py
new file mode 100755
index 000000000..dcd989ef9
--- /dev/null
+++ b/scripts/rcc-depends.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# - Neither the name of the Mumble Developers nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# rcc-depends.py is a small tool that can be used as a drop-in
+# replacement for 'rcc -list' as a command to find dependencies
+# for .qrc files.
+
+from __future__ import (unicode_literals, print_function, division)
+
+import os
+import platform
+import sys
+from xml.dom import minidom
+
+def main():
+ inputs = sys.argv[1:]
+ for fn in inputs:
+ with open(fn, 'r') as f:
+ absFn = os.path.abspath(fn)
+ fnDir = os.path.dirname(absFn)
+ s = f.read()
+ dom = minidom.parseString(s)
+ fileTags = dom.getElementsByTagName('file')
+ for fileTag in fileTags:
+ textNode = fileTag.childNodes[0].wholeText
+ absPath = os.path.normpath(os.path.join(fnDir, textNode))
+ relPath = os.path.relpath(absPath)
+ output = relPath
+ if platform.system() == 'Windows':
+ output = output.replace('\\', '/')
+ print(output)
+
+if __name__ == '__main__':
+ main()