aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-04-08 23:05:14 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-04-08 23:05:14 +0300
commitbfa68aaeaff35ad59110ca34cd4afc6cc8238f29 (patch)
tree941f4a11a2133fb735725ec29b16fd0c3d31e013 /modules
parentc89bbae0ad9136031b35928688700aff6dc05334 (diff)
downloadmeson-bfa68aaeaff35ad59110ca34cd4afc6cc8238f29.zip
meson-bfa68aaeaff35ad59110ca34cd4afc6cc8238f29.tar.gz
meson-bfa68aaeaff35ad59110ca34cd4afc6cc8238f29.tar.bz2
Autodetect Qt5 rcc dependencies as well as reasonably possible.
Diffstat (limited to 'modules')
-rw-r--r--modules/qt5.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/qt5.py b/modules/qt5.py
index 2b9e7d8..5312416 100644
--- a/modules/qt5.py
+++ b/modules/qt5.py
@@ -16,6 +16,7 @@ import dependencies, mlog
import os, subprocess
import build
from coredata import MesonException
+import xml.etree.ElementTree as ET
class Qt5Module():
@@ -87,6 +88,22 @@ class Qt5Module():
else:
mlog.log(' rcc:', mlog.red('NO'))
+ def parse_qrc(self, state, fname):
+ abspath = os.path.join(state.environment.source_dir, state.subdir, fname)
+ try:
+ tree = ET.parse(abspath)
+ root = tree.getroot()
+ result = []
+ for child in root[0]:
+ if child.tag != 'file':
+ mlog.log("Warning, malformed rcc file: ", os.path.join(state.subdir, fname))
+ break
+ else:
+ result.append(os.path.join(state.subdir, child.text))
+ return result
+ except Exception:
+ return []
+
def preprocess(self, state, args, kwargs):
rcc_files = kwargs.pop('qresources', [])
if not isinstance(rcc_files, list):
@@ -109,6 +126,10 @@ class Qt5Module():
'arguments' : ['@INPUT@', '-o', '@OUTPUT@']}
rcc_gen = build.Generator([self.rcc], rcc_kwargs)
rcc_output = build.GeneratedList(rcc_gen)
+ qrc_deps = []
+ for i in rcc_files:
+ qrc_deps += self.parse_qrc(state, i)
+ rcc_output.extra_depends = qrc_deps
[rcc_output.add_file(os.path.join(state.subdir, a)) for a in rcc_files]
sources.append(rcc_output)
if len(ui_files) > 0:
@@ -135,4 +156,6 @@ class Qt5Module():
return sources
def initialize():
+ mlog.log('Warning, rcc dependencies will not work properly until this upstream issue is fixed:',
+ mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'))
return Qt5Module()