diff options
author | Hagen Möbius <hagen.moebius@googlemail.com> | 2022-11-13 20:46:05 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-11-14 00:26:55 +0200 |
commit | 6860e42c065a61cee2f31615fab99af1e20c8e50 (patch) | |
tree | b130184c05fc756d173caef042a569f638e30ff5 | |
parent | 0bfe776132925ee5f075215c3a6a6447e8beb3fa (diff) | |
download | meson-6860e42c065a61cee2f31615fab99af1e20c8e50.zip meson-6860e42c065a61cee2f31615fab99af1e20c8e50.tar.gz meson-6860e42c065a61cee2f31615fab99af1e20c8e50.tar.bz2 |
Raise an error, if the file element in a resource file has no text.
- minor cleanups in the vicinity
-rw-r--r-- | mesonbuild/modules/qt.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 3157c28..73160c0 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -198,12 +198,11 @@ class QtBaseModule(ExtensionModule): abspath: str if isinstance(rcc_file, str): abspath = os.path.join(state.environment.source_dir, state.subdir, rcc_file) - rcc_dirname = os.path.dirname(abspath) else: abspath = rcc_file.absolute_path(state.environment.source_dir, state.environment.build_dir) - rcc_dirname = os.path.dirname(abspath) + rcc_dirname = os.path.dirname(abspath) - # FIXME: what error are we actually trying to check here? + # FIXME: what error are we actually trying to check here? (probably parse errors?) try: tree = ET.parse(abspath) root = tree.getroot() @@ -212,10 +211,14 @@ class QtBaseModule(ExtensionModule): if child.tag != 'file': mlog.warning("malformed rcc file: ", os.path.join(state.subdir, str(rcc_file))) break + elif child.text is None: + raise MesonException(f'<file> element without a path in {os.path.join(state.subdir, str(rcc_file))}') else: result.append(child.text) return rcc_dirname, result + except MesonException: + raise except Exception: raise MesonException(f'Unable to parse resource file {abspath}') |