[PyQt] [SIP5] : An example of SIP5 with QT5.x and PyQt5.y

Phil Thompson phil at riverbankcomputing.com
Tue Apr 14 21:51:55 BST 2020


Are you using pyqtbuild (as QScintilla does)?

Phil

On 14/04/2020 19:06, Robert MARUT wrote:
> -----Message d'origine-----
> De : Phil Thompson <phil at riverbankcomputing.com>
> Envoyé : mardi 14 avril 2020 19:39
> À : Robert MARUT <rmarut at orange.fr>
> Cc : pyqt at riverbankcomputing.com
> Objet : Re: [PyQt] [SIP5] : An example of SIP5 with QT5.x and PyQt5.y
> 
> On 14/04/2020 17:53, Robert MARUT wrote:
>> Thanks for your help Phil. I have to configure all the Qt headers
>> directory in the toml "include-dirs" key.
> 
> You shouldn't need to do that if 'qmake -query' is returning the 
> correct
> values.
> 
> C:\Qt\Qt5.14.1\5.14.1\msvc2017_64\bin>qmake -query
> QT_SYSROOT:
> QT_INSTALL_PREFIX:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64
> QT_INSTALL_ARCHDATA:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64
> QT_INSTALL_DATA:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64
> QT_INSTALL_DOCS:C:/Qt/Qt5.14.1/Docs/Qt-5.14.1
> QT_INSTALL_HEADERS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/include
> QT_INSTALL_LIBS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/lib
> QT_INSTALL_LIBEXECS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/bin
> QT_INSTALL_BINS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/bin
> QT_INSTALL_TESTS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/tests
> QT_INSTALL_PLUGINS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/plugins
> QT_INSTALL_IMPORTS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/imports
> QT_INSTALL_QML:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/qml
> QT_INSTALL_TRANSLATIONS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/translations
> QT_INSTALL_CONFIGURATION:
> QT_INSTALL_EXAMPLES:C:/Qt/Qt5.14.1/Examples/Qt-5.14.1
> QT_INSTALL_DEMOS:C:/Qt/Qt5.14.1/Examples/Qt-5.14.1
> QT_HOST_PREFIX:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64
> QT_HOST_DATA:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64
> QT_HOST_BINS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/bin
> QT_HOST_LIBS:C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/lib
> QMAKE_SPEC:win32-msvc
> QMAKE_XSPEC:win32-msvc
> QMAKE_VERSION:3.1
> QT_VERSION:5.14.1
> 
> pyproject.toml
> 
> # Specify sip v5 as the build system for the package.
> [build-system]
> requires = ["sip >=5, <6"]
> build-backend = "sipbuild.api"
> 
> # Sip project
> [tool.sip.project]
> sip-include-dirs = ["C:/Program
> Files/Python37/Lib/site-packages/PyQt5/bindings"]
> 
> # Specify the PEP 566 metadata for the project.
> [tool.sip.metadata]
> name = "Operations"
> 
> # Configure the building of the Operations bindings.
> [tool.sip.bindings.Operations]
> headers = ["Operations.h"]
> include-dirs = ["../Operations",
> "C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/include",
> "C:/Qt/Qt5.14.1/5.14.1/msvc2017_64/include/QtCore"]
> libraries = ["Operations"]
> library-dirs = ["../Operations/Compilation/release"]
> 
> 
> if include-dirs =["../Operations"] when build with sip-build, I have 
> got the
> following message error : 'QMetaType' : No such file or directory
> 
>> I can build now my example with sip5 but trying to import the library
>> into Python. I have this error message : " RuntimeError: the
>> PyQt5.QtCore module failed to register with the sip module"
> 
> At a guess I'd say PyQt5 is importing a different sip module to your 
> own
> module.
> 
> Phil
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt



More information about the PyQt mailing list