From 1483ff628f4fe657eddcb78d98c348ea132d0955 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 9 Feb 2024 11:55:32 +0100 Subject: pyside6-project: Ensure rc_.py files are built last Resource might depend on generated files. Introduce a sort function to ensure .qrc goes last. Pick-to: 6.6 6.5 Change-Id: I8188eda00247cb192a485f30755100862d6895a1 Reviewed-by: Cristian Maureira-Fredes --- sources/pyside-tools/project.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sources/pyside-tools/project.py') diff --git a/sources/pyside-tools/project.py b/sources/pyside-tools/project.py index 621bf1ac7..bb468729a 100644 --- a/sources/pyside-tools/project.py +++ b/sources/pyside-tools/project.py @@ -52,6 +52,16 @@ NEW_PROJECT_TYPES = {"new-quick": ProjectType.QUICK, "new-widget": ProjectType.WIDGET} +def _sort_sources(files: List[Path]) -> List[Path]: + """Sort the sources for building, ensure .qrc is last since it might depend + on generated files.""" + + def key_func(p: Path): + return p.suffix if p.suffix != ".qrc" else ".zzzz" + + return sorted(files, key=key_func) + + class Project: """ Class to wrap the various operations on Project @@ -149,7 +159,7 @@ class Project: Project(project_file=sub_project_file).build() if self._qml_module_dir: self._qml_module_dir.mkdir(exist_ok=True, parents=True) - for file in self.project.files: + for file in _sort_sources(self.project.files): self._build_file(file) self._regenerate_qmldir() -- cgit v1.2.3