From 6860e42c065a61cee2f31615fab99af1e20c8e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hagen=20M=C3=B6bius?= Date: Sun, 13 Nov 2022 20:46:05 +0100 Subject: Raise an error, if the file element in a resource file has no text. - minor cleanups in the vicinity --- mesonbuild/modules/qt.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules/qt.py') 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' 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}') -- cgit v1.1