From cacc9c5803a6dec820dd46211a836453183c8dab Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Oct 2024 08:11:46 +0200 Subject: [PATCH] build: Install module doc snippet files Amends b55e221464c18053fa44f18132071ebdaee8f432. Task-number: PYSIDE-1106 Fixes: PYSIDE-2893 Change-Id: I4a2688bfb5fcdddc5c6baea49d2fdc9c0f2381f1 Reviewed-by: Shyamnath Premnadh (cherry picked from commit ad155e67a208d4ac4c20d7033701d6ddb3d2593e) Reviewed-by: Qt Cherry-pick Bot --- build_scripts/platforms/unix.py | 8 ++++---- build_scripts/platforms/windows_desktop.py | 7 +++---- build_scripts/wheel_files.py | 3 +++ sources/pyside6/cmake/Macros/PySideModules.cmake | 9 +++++++++ 4 files changed, 19 insertions(+), 8 deletions(-) Index: pyside-setup-everywhere-src-6.8.0/build_scripts/platforms/unix.py =================================================================== --- pyside-setup-everywhere-src-6.8.0.orig/build_scripts/platforms/unix.py +++ pyside-setup-everywhere-src-6.8.0/build_scripts/platforms/unix.py @@ -199,10 +199,10 @@ def prepare_packages_posix(pyside_build, # /share/{st_package_name}/glue/* -> # /{st_package_name}/glue - copydir( - "{install_dir}/share/{st_package_name}/glue", - "{st_build_dir}/{st_package_name}/glue", - _vars=_vars) + for glue in ['glue', 'doc']: + source = "{install_dir}/share/{st_package_name}/" + glue + target = "{st_build_dir}/{st_package_name}/" + glue + copydir(source, target, _vars=_vars) if not is_android: # /pyside6/{st_package_name}/support/* -> Index: pyside-setup-everywhere-src-6.8.0/build_scripts/platforms/windows_desktop.py =================================================================== --- pyside-setup-everywhere-src-6.8.0.orig/build_scripts/platforms/windows_desktop.py +++ pyside-setup-everywhere-src-6.8.0/build_scripts/platforms/windows_desktop.py @@ -153,10 +153,9 @@ def prepare_packages_win32(pyside_build, # /share/{st_package_name}/glue/* -> # /{st_package_name}/glue - copydir( - "{install_dir}/share/{st_package_name}/glue", - destination_dir / "glue", - _vars=_vars) + for glue in ['glue', 'doc']: + source = "{install_dir}/share/{st_package_name}/" + glue + copydir(source, destination_dir / glue, _vars=_vars) # /pyside6/{st_package_name}/support/* -> # /{st_package_name}/support/* Index: pyside-setup-everywhere-src-6.8.0/build_scripts/wheel_files.py =================================================================== --- pyside-setup-everywhere-src-6.8.0.orig/build_scripts/wheel_files.py +++ pyside-setup-everywhere-src-6.8.0/build_scripts/wheel_files.py @@ -59,6 +59,7 @@ class ModuleData: typesystems: list[str] = field(default_factory=list) include: list[str] = field(default_factory=list) glue: list[str] = field(default_factory=list) + doc_glue: list[str] = field(default_factory=list) metatypes: list[str] = field(default_factory=list) plugins: list[str] = field(default_factory=list) @@ -87,6 +88,7 @@ class ModuleData: self.typesystems.append(f"typesystem_{_lo}.xml") self.include.append(f"Qt{self.name}/*.h") self.glue.append(f"qt{_lo}.cpp") + self.doc_glue.append(f"qt{_lo}.rst") if not len(self.metatypes): self.metatypes.append(f"qt6{_lo}_relwithdebinfo_metatypes.json") @@ -122,6 +124,7 @@ class ModuleData: self.typesystems = [f"typesystems/{i}" for i in self.typesystems] self.include = [f"include/{i}" for i in self.include] self.glue = [f"glue/{i}" for i in self.glue] + self.doc_glue = [f"doc/{i}" for i in self.doc_glue] def macos_pyside_wrappers_lib(self, s): if s.startswith("Qt"): Index: pyside-setup-everywhere-src-6.8.0/sources/pyside6/cmake/Macros/PySideModules.cmake =================================================================== --- pyside-setup-everywhere-src-6.8.0.orig/sources/pyside6/cmake/Macros/PySideModules.cmake +++ pyside-setup-everywhere-src-6.8.0/sources/pyside6/cmake/Macros/PySideModules.cmake @@ -176,6 +176,14 @@ macro(create_pyside_module) set(${module_NAME}_glue_dependency ${${module_NAME}_glue}) endif() + # Install module doc files. + set(${module_NAME}_doc "${CMAKE_CURRENT_SOURCE_DIR}/../doc/${lower_module_name}.rst") + set(${module_name}_doc_dependency "") + if(EXISTS ${${module_NAME}_doc}) + install(FILES ${${module_NAME}_doc} DESTINATION share/PySide6${pyside6_SUFFIX}/doc) + set(${module_NAME}_doc_dependency ${${module_NAME}_doc}) + endif() + # Install standalone glue files into typesystems subfolder, so that the resolved relative # paths remain correct. if (module_GLUE_SOURCES) @@ -245,6 +253,7 @@ macro(create_pyside_module) DEPENDS ${total_type_system_files} ${module_GLUE_SOURCES} ${${module_NAME}_glue_dependency} + ${${module_NAME}_doc_dependency} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running generator for ${module_NAME}...")