linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libgpiod][PATCH v3 0/1] bindings: python: optionally include module in sdist
@ 2023-10-13 11:28 Phil Howard
  2023-10-13 11:28 ` [libgpiod][PATCH v3 1/1] " Phil Howard
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Howard @ 2023-10-13 11:28 UTC (permalink / raw)
  To: Linus Walleij, Andy Shevchenko, Kent Gibson, Bartosz Golaszewski
  Cc: linux-gpio, Phil Howard

This changeset vendors the gpiod library into the Python package.

Why?

So that setup.py can produce an sdist that is installable irrespective of the
availability or version of a distro-supplied libgpiod.

This prevents a libgpiod pypi package install balking because the distro
libgpiod is outdated or otherwise incompatible. This happens when attempting to
install the current libgpiod from pypi onto - for example - the Debian Bookworm
based Raspberry Pi OS.

The availability of a distro agnostic package also ensures that libgpiod can be
installed via pypi into an isolated virtual environment, safely specified as a
dependency for Python packages and allows Python developers to target the newest
API version irrespective of their distro supplied libgpiod.

This is essential, since a venv is now widely *required* for user Python
projects due to recommendations in pep-688 - https://peps.python.org/pep-0668/

For Raspberry Pi this sdist can also be converted into a precompiled wheel by
piwheels [1] which is, by default, added to Raspberry Pi OS as a pip index.

How?

If "LINK_SYSTEM_LIBGPIOD=1" is not specified then the gpiod._ext C Extension is
amended to include all of the C sources for gpiod, so it can be built as a
standalone module without depending upon a shared distro library.

python/bindings/Makefile.am has been modified so that this variable is included
for the "build_ext --inplace" build, preserving the old, linked behaviour.

The gpiod sources are included by copying the "lib" and "include" directories
up to the parent module, and updating "MANIFEST.in" to include the source files
when an sdist is built. Additionally the gpiod version string is included in
"libgpiod-version-str.txt" so that it is available for source builds.

Additionally bindings/python/Makefile.am has been extended so that "make"
will now produce a .tar.gz source distribution in bindings/python/dist which is
suitable for uploading to pypi and can be built and installed by any user with
python3-dev installed.

[1] - https://www.piwheels.org/


Phil Howard (1):
  bindings: python: optionally include module in sdist

 bindings/python/MANIFEST.in |   5 ++
 bindings/python/Makefile.am |   5 ++
 bindings/python/setup.py    | 107 ++++++++++++++++++++++++++++++------
 3 files changed, 101 insertions(+), 16 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-16 14:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13 11:28 [libgpiod][PATCH v3 0/1] bindings: python: optionally include module in sdist Phil Howard
2023-10-13 11:28 ` [libgpiod][PATCH v3 1/1] " Phil Howard
2023-10-16 13:10   ` Bartosz Golaszewski
2023-10-16 13:45     ` Phil Howard
2023-10-16 14:24       ` Bartosz Golaszewski
2023-10-16 14:41       ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).