SIP real library wrapping

ZephOne zephone at protonmail.com
Fri Jan 15 09:47:57 GMT 2021


Thanks for the answer.

Indeed, the top level .pro file is not the same.

The organisation of the project is like this:

.
├── build
│   └── sip.h
├── myeventfilters
│   ├── myeventfilters.cpp
│   ├── myeventfilters.h
│   └── myeventfilters.pro
├── Dockerfile
├── MANIFEST.in
├── project.py
├── pyproject.toml
├── README.md
├── setup.cfg
├── setup.py
└── sip
    └── customeventfilters.sip

When the build folder is generated containing the top level .pro file, the top level .pro file does not include as subdirs the folders rootproject/myeventfilters and then is missing myeventfilters (I think). With sip4, the subdirs rootproject/myeventfilters was included.
So I will try to modify it via the project.py file like it seems to be done with the project.py file in PyQt5.




‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, January 13, 2021 3:52 PM, Phil Thompson <phil at riverbankcomputing.com> wrote:

> On 13/01/2021 14:31, ZephOne wrote:
> 

> > Hello,
> > migrating from SIP v4 build system to SIP v5 build system I'm trying
> > to build wheel for a simple PyQt extension written in C++, a custom
> > event filters.
> > The pyproject.toml is like this :
> > [build-system]
> > requires = ["sip >=5, <7", "PyQt-builder", "PyQt5"]
> > buid-backend = "sipbuild.api"
> > [tool.sip.metadata]
> > name = "customeventfilters"
> > version = "0.7.0"
> > description = "Custom PyQt5 event filters"
> > author = "ZephOne"
> > author-email = "zephone at protonmail.com"
> > license='BSD'
> > requires-dist = "PyQt5"
> > [tool.sip.project]
> > sdist-excludes = [
> >   ".git/",
> >   ".git//",
> >   ".git///",  ".git////",
> >   ".git/////",
> >   ".git//////",
> >   ".git///////"]
> > And the project.py which is used only to specify the location of the
> > C++ library is like this:
> > """The build configuration file for CustomEventFilters, used by sip."""
> > import os
> > from pyqtbuild import PyQtBindings, PyQtProject
> > from sipbuild import Option
> > class CustomEventFilters(PyQtProject):
> >     """The Project class."""
> > def init(self):
> >         """ Initialise the project. """
> > super().init()
> > self.bindings_factories = [MyEventFilters]
> > class MyEventFilters(PyQtBindings):
> >     """ My event filters bindings. """
> > def init(self, project):
> >         """ Initialise the bindings. """
> > super().init(
> >             project,
> >             "MyEventFilters",
> >             sip_file='myeventfilters.sip'
> >         )
> > def apply_user_defaults(self, tool):
> >         """ Set default values for user options that haven't been set
> > yet. """
> > if self.myeventfilters_include_dir is not None:
> >             self.include_dirs.append(
> >                 os.path.abspath(
> >                     self.myeventfilters_include_dir
> >                 )
> >             )
> > if self.myeventfilters_library_dir is not None:
> >             self.include_dirs.append(
> >                 os.path.abspath(
> >                     self.myeventfilters_library_dir
> >                 )
> >             )
> > super().apply_user_defaults(tool)
> > def get_options(self):
> >         """ Return the list of configurable options. """
> > options = super().get_options()
> > options.append(
> >             Option(
> >                 "myeventfilters_include_dir",
> >                 help="the my event filters include file directory is in
> > DIR",
> >                 metavar="DIR"
> >             )
> >         )
> > options.append(
> >             Option(
> >                 "myeventfilters_library_dir",
> >                 help="the my event filters library is in DIR",
> >                 metavar="DIR"
> >             )
> >         )
> > return options
> > I think there's no problem with the C++ library (I had no problem
> > SIP4).
> > With these two files I have no problem building the the wheel, using
> > sip-wheel.
> > But when I try to import it in a python console I've got this error:
> > ImportError:
> > /venvdir/customeventfilters/lib/python3.9/site-packages/customeventfilters.cpython-39-x86_64-linux-gnu.so:
> > undefined symbol: _ZTI18GenericEventFilter
> > GenericEventFilter is a class defined in the C++ library.
> > Did I miss something binding the C++ extension ?
> 

> If your C++ library is installed in a non-standard location then I'd
> look at the rpath.
> 

> I'd also compare the .pro files generated by v4 and v5.
> 

> Phil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: publickey - zephone at protonmail.com - 0x755CCE18.asc
Type: application/pgp-keys
Size: 670 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210115/2616d090/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210115/2616d090/attachment.sig>


More information about the PyQt mailing list