On Fri, 20 Oct 2023 16:57:04 +0200, Phil Howard <phil@xxxxxxxxxxxxx> said: > Optionally vendor libgpiod source into sdist so that the Python module can > be built from source, even with a missing or mismatched system libgpiod. > > Add two new environment variables "LINK_SYSTEM_LIBGPIOD" and > "GPIOD_VERSION" to control what kind of package setup.py will build. > > In order to build an sdist or wheel package with a vendored libgpiod a > version must be specified via the "GPIOD_VERSION" environment variable. > > This will instruct setup.py to fetch the tarball matching the requested > version from mirrors.edge.kernel.org, verify the sha256 signature, unpack > it, and copy the lib and include directories into the package root so they > can be included in sdist or used to build a binary wheel. > > eg: GPIOD_VERSION=2.0.2 python3 setup.py sdist > > Will build a source distribution with gpiod version 2.0.2 source included. > > It will also save the gpiod version into "gpiod-version.txt" so that it > can be passed to the build when the sdist is built by pip. > > Requiring an explicit version ensures that the Python bindings - which > can be changed and versions independent of libgpiod - are built against a > stable libgpiod release. > > In order to force a package with vendored gpiod source to link the system > libgpiod, the "LINK_SYSTEM_LIBGPIOD" environment variable can be used: > > eg: LINK_SYSTEM_LIBGPIOD=1 pip install libgpiod > > Signed-off-by: Phil Howard <phil@xxxxxxxxxxxxx> > --- Eh... we have one more thing to figure out here. gpiod_line_request_get_chip_name() has been added to the library and supported in python bindings in current master but hasn't been released yet. So when I go GPIOD_VERSION=2.0.2 python3 setup.py sdist it builds fine but then I get the following when trying to import gpiod: >>> import gpiod Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.11/site-packages/gpiod/__init__.py", line 10, in <module> from . import _ext ImportError: /usr/lib/python3.11/site-packages/gpiod/_ext.cpython-311-x86_64-linux-gnu.so: undefined symbol: gpiod_line_request_get_chip_name I can of course make a libgpiod v2.1.0 release - we already have quite a bit of new material but we should probably add something like a "minimum libgpiod version" switch somewhere. Do you have any ideas? Bart