Correct way to add third-party sip extensions to pyqtdeploy project?

Phil Thompson phil at riverbankcomputing.com
Thu Sep 24 09:28:32 BST 2020


On 24/09/2020 06:59, Patrick Stinson wrote:
> Got it.
> 
> I’ve now managed to get pyqtdeploy to use my sysroot component plugin
> to add my app’s extension module source files to the qmake project. Is
> there any way to tell the ExtensionModule that there is a sip file so
> it will do what sip-build does by generating the C++ sources and
> setting up C++ flags correctly? What about generating moc files for .h
> headers?
> 
> My extension is starting to get busy with those mangled sip-build file
> names, and it’s also complaining about sip.h, and I imagine more
> things if I fix those problems with manual paths.
> 
> 
> class VedanaComponent(Component):
>     """ The vedana module component. """
> 
>     must_install_from_source = False
>     preinstalls = ['Python', 'PyQt', 'Qt', 'SIP']
>     provides = {
>         '_pkdiagram':
>             ExtensionModule(
>                 deps='PyQt:PyQt5.QtWidgets',
>                 source=[
>                     "../../../_pkdiagram/unsafearea.cpp",
>                     "../../../_pkdiagram/_pkdiagram.cpp",
>                     "../../../_pkdiagram/_pkdiagram_mac.mm",
>                     
> "../../../_pkdiagram/build/_pkdiagram/moc_unsafearea.cpp",
>                     
> "../../../_pkdiagram/build/_pkdiagram/moc__pkdiagram.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramAppFilter.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramcmodule.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramCUtil.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramFDDocument.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramPathItemBase.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramPathItemDelegate.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramPersonDelegate.cpp",
> 
> "../../../_pkdiagram/build/_pkdiagram/sip_pkdiagramQMap0100QString0100QString.cpp",
>                 ],
>                 defines=[ "PK_DEBUG_BUILD=0" ],
>                 qmake_qt=[ 'gui', 'widgets' ]
>             )
>     }
> 
>     def get_archive_name(self):
>         return ''
> 
>     def install(self):
>         """ Install for the target. """

Take a look the AbstractPyQtComponent class in 
abstract_pyqt_component.py (and the other abstract components in the 
same directory).

This is not documented and so is not currently part of the public API 
(despite what the comments say). However it may be what you are looking 
for. If so I'll document them properly. In the meantime have a look at 
the PyQtChart plugin (for example) to see how the methods implemented 
are used.

Phil


More information about the PyQt mailing list