diff options
author | Alexis Jeandet <alexis.jeandet@member.fsf.org> | 2018-04-04 01:06:43 +0200 |
---|---|---|
committer | Alexis Jeandet <alexis.jeandet@member.fsf.org> | 2018-04-04 01:06:43 +0200 |
commit | b4cd949c48ab67891e4bc6b14a8f9f247e28777d (patch) | |
tree | aadef1060ca47237291454781d26086bab632837 /mesonbuild/modules/qt.py | |
parent | ebeb248c07693da5e5f4f7b80fafadd98939d045 (diff) | |
download | meson-b4cd949c48ab67891e4bc6b14a8f9f247e28777d.zip meson-b4cd949c48ab67891e4bc6b14a8f9f247e28777d.tar.gz meson-b4cd949c48ab67891e4bc6b14a8f9f247e28777d.tar.bz2 |
[Qt module] More qrc fixes
When several qrc files are given all qrc files dependencies were mixed.
Fixed non working use case:
When user try to guess build dir layout and add use a relative
path between a generated qrc file and a generated resource.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Diffstat (limited to 'mesonbuild/modules/qt.py')
-rw-r--r-- | mesonbuild/modules/qt.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 1625218..a306af7 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -74,10 +74,10 @@ class QtBaseModule: def parse_qrc(self, state, rcc_file): if type(rcc_file) is str: abspath = os.path.join(state.environment.source_dir, state.subdir, rcc_file) - relative_part = os.path.dirname(rcc_file) + rcc_dirname = os.path.dirname(abspath) elif type(rcc_file) is File: abspath = rcc_file.absolute_path(state.environment.source_dir, state.environment.build_dir) - relative_part = os.path.dirname(abspath) + rcc_dirname = os.path.dirname(abspath) try: tree = ET.parse(abspath) @@ -102,13 +102,14 @@ class QtBaseModule: else: result.append(File(is_built=False, subdir=state.subdir, fname=resource_path)) else: + path_from_build = os.path.normpath(os.path.join(state.environment.build_dir, resource_path)) + path_from_rcc = os.path.join(rcc_dirname, resource_path) # a) - if os.path.exists(state.environment.build_dir + resource_path): + if path_from_build.startswith(state.environment.build_dir) and not os.path.exists(path_from_rcc): result.append(File(is_built=True, subdir=state.subdir, fname=resource_path)) # b) else: - result.append(File(is_built=False, subdir=state.subdir, - fname=os.path.join(relative_part, resource_path))) + result.append(File(is_built=False, subdir=state.subdir, fname=path_from_rcc)) return result except Exception: return [] @@ -127,11 +128,11 @@ class QtBaseModule: if len(rcc_files) > 0: if not self.rcc.found(): raise MesonException(err_msg.format('RCC', 'rcc-qt{}'.format(self.qt_version), self.qt_version)) - qrc_deps = [] - for i in rcc_files: - qrc_deps += self.parse_qrc(state, i) # custom output name set? -> one output file, multiple otherwise if len(args) > 0: + qrc_deps = [] + for i in rcc_files: + qrc_deps += self.parse_qrc(state, i) name = args[0] rcc_kwargs = {'input': rcc_files, 'output': name + '.cpp', @@ -141,6 +142,7 @@ class QtBaseModule: sources.append(res_target) else: for rcc_file in rcc_files: + qrc_deps = self.parse_qrc(state, rcc_file) if type(rcc_file) is str: basename = os.path.basename(rcc_file) elif type(rcc_file) is File: |