diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-02-09 11:55:32 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-02-12 13:15:46 +0100 |
commit | 1483ff628f4fe657eddcb78d98c348ea132d0955 (patch) | |
tree | 4eecd40804e422a46d3a76660ca3ff1a6cd61d05 /sources/pyside-tools/project.py | |
parent | 467b6dae13c2af0aa58100f4a1991895ebd2d6ec (diff) |
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 <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside-tools/project.py')
-rw-r--r-- | sources/pyside-tools/project.py | 12 |
1 files changed, 11 insertions, 1 deletions
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() |