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

Phil Thompson phil at riverbankcomputing.com
Fri Sep 25 09:09:57 BST 2020


Make it the current directory.

On 24/09/2020 22:19, Patrick Stinson wrote:
> If so, how would I do that?
> 
>> On Sep 24, 2020, at 1:19 PM, Patrick Stinson <patrickkidd at gmail.com> 
>> wrote:
>> 
>> Ah right. So I am assuming that dealing with the .sip file is in the 
>> pyproject.toml.
>> 
>> Mine is currently called pyproject.toml and sits in the folder with 
>> the extension source. Maybe I need to tell the component where the 
>> folder is so it can find pyproject.toml?
>> 
>>> On Sep 24, 2020, at 1:17 PM, Phil Thompson 
>>> <phil at riverbankcomputing.com <mailto:phil at riverbankcomputing.com>> 
>>> wrote:
>>> 
>>> pyqtdeploy knows nothing about moc - that's down to qmake.
>>> 
>>> The .toml file must be called pyproject.toml - that's specified in 
>>> PEP 518.
>>> 
>>> On 24/09/2020 21:39, Patrick Stinson wrote:
>>>> I should add that moc is not being run for all of my headers listed 
>>>> in
>>>> the toml file. Though as per my previous email, I’m not sure if you
>>>> are suggesting that there is any code in pyqtdeploy that would do 
>>>> such
>>>> a thing for moc files or for sip-generated sources. I debugged
>>>> pyqtdeploy-build and didn’t see anything to that effect.
>>>>> On Sep 24, 2020, at 9:55 AM, Patrick Stinson <patrickkidd at gmail.com 
>>>>> <mailto:patrickkidd at gmail.com>> wrote:
>>>>> OK, I am gathering that do this in my component plugin:
>>>>>    def install(self):
>>>>>        pyqt = self.get_component('PyQt')
>>>>>        pyqt.install_pyqt_component(self)
>>>>> Now I’m getting unresolved symbols for my extension module, though 
>>>>> some moc files are generated so something is happening there.
>>>>> It looks like install_pyqt_component() loads the project file for 
>>>>> the component, though I have no idea how it finds it. Mine is in 
>>>>> <APPROOT>/_pkdiagram/_pkdiagram.toml.
>>>>> My sysroot is in <APPROOT>/vendor/sysroot.toml.
>>>>> Pyqtdeploy-build doesn’t complain if I rename my pyproject.toml 
>>>>> even though the code says it should complain, so I know it isn’t 
>>>>> finding the file in order to figure out where the .sip file and 
>>>>> other sources are.
>>>>>> On Sep 24, 2020, at 12:28 AM, Phil Thompson 
>>>>>> <phil at riverbankcomputing.com 
>>>>>> <mailto:phil at riverbankcomputing.com><mailto:phil at riverbankcomputing.com 
>>>>>> <mailto:phil at riverbankcomputing.com>>> wrote:
>>>>>> 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