Raise an error, if the file element in a resource file has no text.
minor cleanups in the vicinity
@@ -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)
- # 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}')
