All of lore.kernel.org
 help / color / mirror / Atom feed
* [libgpiod][PATCH v9 0/1] bindings: python: optionally include module in sdist
@ 2023-10-25  8:27 Phil Howard
  2023-10-25  8:27 ` [libgpiod][PATCH v9 1/1] " Phil Howard
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Howard @ 2023-10-25  8:27 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 or Ubuntu 23.10 Mantic which both
ship with libgpiod v1.6.3.

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 [1]

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

How?

If "LINK_SYSTEM_LIBGPIOD=1" is not specified and a valid "LIBGPIOD_VERSION"
is supplied then setup.py will first verify the requested version meets or
exceeds "GPIOD_MINIMUM_VERSION".

If this check passes it will fetch the requested, stable tarball from
mirrors.edge.kernel.org, verify the checksum, unpack the "lib" and
"include" directories and vendor them into the output sdist.

It will also drop a "libgpiod-version.txt" so that the sdist knows what
GPIOD_VERSION_STR to pass into the gpiod build, eg:

LIBGPIOD_VERSION="2.1.0" python3 -m build . --sdist

Will output dist/libgpiod-2.1.0.tar.gz vendoring libgpiod v2.1.0.

If "libgpiod-version.txt" exists and the version in "libgpiod-version.txt"
matches the requested LIBGPIOD_VERSION then lib and include are assumed to
already exist and the tarball fetch will be skipped. This prevents build
from trying to fetch the tarball twice when called with:

LIBGPIOD_VERSION="2.1.0" python3 -m build .

Runtime dependencies for fetching and vendoring a tarball are only imported
when an sdist or build_ext command is triggered with "LIBGPIOD_VERSION".

When a user builds or installs an sdist (via pip install or otherwise) if a
"libgpiod-version.txt" exists and "LINK_SYSTEM_LIBGPIOD=1" is not specified
in their environment then the gpiod._ext C Extension is amended to include
all of the vendored C sources for gpiod and the resulting module build will
function independently of the system libgpiod.

Fetching libgpiod tarballs is an effort to reconsile the fact that both
libgpiod and the Python bindings live in the same source tree but are
versioned independently of each other. Bugfixes and changes to Python
bindings should not vendor unstable, development versions of libgpiod.

No effort has been made to allow an unstable, vendored build since it's
assumed developers will build and install libgpiod and use
"LINK_SYSTEM_LIBGPIOD".

While the output sdist will - by default - build a standalone gpiod module
it's possible for the end user to supply the "LINK_SYSTEM_LIBGPIOD=1" env
variable to override this behaviour and attempt to link their system
libgpiod (this will fail if it's incompatible with the bindings) eg:

LINK_SYSTEM_LIBPGIOD=1 pip install libgpiod

[1] - https://peps.python.org/pep-0668/
[2] - https://www.piwheels.org/

Changes v8 -> v9
- Removed Version testing hack

Changes v7 -> v8
- Tweak sha256sums parsing for better clarity
- Add check for libgpiod-version.txt to prevent "build" trying to refetch
- Added a URL to metadata to stop setup.py complaining
- Change GPIOD_MINIMUM_VERSION to LIBGPIOD_MINIMUM_VERSION
- Change GPIOD_VERSION to LIBGPIOD_VERSION

Changes v6 -> v7
- Added GPIOD_MINIMUM_VERSION to catch builds against incompatible libgpiod
- Set GPIOD_MINIMUM_VERSION to 2.1.0
- New requirement "packaging" added to pyproject.toml

Changes v5 -> v6
- Change SRC_BASE_URL to mirrors.edge.kernel.org
- Fetch sha256sums.asc and verify tarball signature
- Moved tarfile and urllib imports to fetch_tarball for fewer runtime deps
- Download and extract into a temporary directory
- Changed print to log.info
- Changed print/return errors to raise BaseError
- Check for lib/include in build tree and bail early

Changes v4 -> v5
- Move logic from main program flow to build_ext and sdist overloads
- GPIOD_VERSION_STR is now GPIOD_VERSION
- Fetch sources from a libgpiod tarball if GPIOD_VERSION is supplied
- Removed changes to bindings/python/Makefile.am
- Moved and rephrased comment about build_ext rmtree("tests")

Changes v3 -> v4
- Check for lack of "GPIOD_VERSION_STR" and revert to original behaviour
- Add status messages to setup.py, hinting at the package build mode

Changes v2 -> v3
- Pass in correct "GPIOD_VERSION_STR" from build
- Output an sdist build for pypi

Changes v1 -> v2
- Switch from symlinks to explicit file copy

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

 bindings/python/MANIFEST.in    |   5 +
 bindings/python/pyproject.toml |   2 +-
 bindings/python/setup.py       | 212 +++++++++++++++++++++++++++++++--
 3 files changed, 207 insertions(+), 12 deletions(-)

-- 
2.34.1


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

* [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-10-25  8:27 [libgpiod][PATCH v9 0/1] bindings: python: optionally include module in sdist Phil Howard
@ 2023-10-25  8:27 ` Phil Howard
  2023-10-25 12:50   ` Bartosz Golaszewski
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Howard @ 2023-10-25  8:27 UTC (permalink / raw)
  To: Linus Walleij, Andy Shevchenko, Kent Gibson, Bartosz Golaszewski
  Cc: linux-gpio, Phil Howard

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
"LIBGPIOD_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 "LIBGPIOD_VERSION" environment variable.

This will instruct setup.py to verify the given version against the list
in sha256sums.asc and ensure it meets or exceeds a LIBGPIOD_MINIMUM_VERSION
required for compatibility with the bindings.

It will then 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: LIBGPIOD_VERSION=2.1.0 python3 setup.py sdist

Will build a source distribution with gpiod version 2.1.0 source included.

It will also save the gpiod version into "libgpiod-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@gadgetoid.com>
---
 bindings/python/MANIFEST.in    |   5 +
 bindings/python/pyproject.toml |   2 +-
 bindings/python/setup.py       | 212 +++++++++++++++++++++++++++++++--
 3 files changed, 207 insertions(+), 12 deletions(-)

diff --git a/bindings/python/MANIFEST.in b/bindings/python/MANIFEST.in
index 459b317..efdfd18 100644
--- a/bindings/python/MANIFEST.in
+++ b/bindings/python/MANIFEST.in
@@ -3,6 +3,7 @@
 
 include setup.py
 include README.md
+include libgpiod-version.txt
 
 recursive-include gpiod *.py
 recursive-include tests *.py
@@ -12,3 +13,7 @@ recursive-include gpiod/ext *.h
 
 recursive-include tests/gpiosim *.c
 recursive-include tests/procname *.c
+
+recursive-include lib *.c
+recursive-include lib *.h
+recursive-include include *.h
diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml
index fcf6bbe..f6bf43c 100644
--- a/bindings/python/pyproject.toml
+++ b/bindings/python/pyproject.toml
@@ -2,4 +2,4 @@
 # SPDX-FileCopyrightText: 2023 Phil Howard <phil@gadgetoid.com>
 
 [build-system]
-requires = ["setuptools", "wheel"]
+requires = ["setuptools", "wheel", "packaging"]
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index c8db0a0..904b5f3 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -1,24 +1,216 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
 
-from os import environ, path
-from setuptools import setup, Extension, find_packages
+from os import getenv, path, unlink
+from shutil import copytree, rmtree
+
+from setuptools import Extension, find_packages, setup
 from setuptools.command.build_ext import build_ext as orig_build_ext
-from shutil import rmtree
+from setuptools.command.sdist import log
+from setuptools.command.sdist import sdist as orig_sdist
+from setuptools.errors import BaseError
+
+LINK_SYSTEM_LIBGPIOD = getenv("LINK_SYSTEM_LIBGPIOD") == "1"
+LIBGPIOD_MINIMUM_VERSION = "2.1.0"
+LIBGPIOD_VERSION = getenv("LIBGPIOD_VERSION")
+GPIOD_WITH_TESTS = getenv("GPIOD_WITH_TESTS") == "1"
+SRC_BASE_URL = "https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/"
+TAR_FILENAME = "libgpiod-{version}.tar.gz"
+ASC_FILENAME = "sha256sums.asc"
+SHA256_CHUNK_SIZE = 2048
+
+# __version__
+with open("gpiod/version.py", "r") as fd:
+    exec(fd.read())
+
+
+def sha256(filename):
+    """
+    Return a sha256sum for a specific filename, loading the file in chunks
+    to avoid potentially excessive memory use.
+    """
+    from hashlib import sha256
+
+    sha256sum = sha256()
+    with open(filename, "rb") as f:
+        for chunk in iter(lambda: f.read(SHA256_CHUNK_SIZE), b""):
+            sha256sum.update(chunk)
+
+    return sha256sum.hexdigest()
+
+
+def find_sha256sum(asc_file, tar_filename):
+    """
+    Search through a local copy of sha256sums.asc for a specific filename
+    and return the associated sha256 sum.
+    """
+    with open(asc_file, "r") as f:
+        for line in f:
+            line = line.strip().split("  ")
+            if len(line) == 2 and line[1] == tar_filename:
+                return line[0]
+
+    raise BaseError(f"no signature found for {tar_filename}")
+
+
+def fetch_tarball(command):
+    """
+    Verify the requested LIBGPIOD_VERSION tarball exists in sha256sums.asc,
+    fetch it from https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/
+    and verify its sha256sum.
+
+    If the check passes, extract the tarball and copy the lib and include
+    dirs into our source tree.
+    """
+
+    # If no LIBGPIOD_VERSION is specified in env, just run the command
+    if LIBGPIOD_VERSION is None:
+        return command
+
+    # If LIBGPIOD_VERSION is specified, apply the tarball wrapper
+    def wrapper(self):
+        # Just-in-time import of tarfile and urllib.request so these are
+        # not required for Yocto to build a vendored or linked package
+        import tarfile
+        from tempfile import TemporaryDirectory
+        from urllib.request import urlretrieve
+
+        from packaging.version import Version
+
+        # The "build" frontend will run setup.py twice within the same
+        # temporary output directory. First for "sdist" and then for "wheel"
+        # This would cause the build to fail with dirty "lib" and "include"
+        # directories.
+        # If the version in "libgpiod-version.txt" already matches our
+        # requested tarball, then skip the fetch altogether.
+        try:
+            if open("libgpiod-version.txt", "r").read() == LIBGPIOD_VERSION:
+                log.info(f"skipping tarball fetch")
+                command(self)
+                return
+        except OSError:
+            pass
+
+        # Early exit for build tree with dirty lib/include dirs
+        for check_dir in "lib", "include":
+            if path.isdir(f"./{check_dir}"):
+                raise BaseError(f"refusing to overwrite ./{check_dir}")
+
+        with TemporaryDirectory(prefix="libgpiod-") as temp_dir:
+            tarball_filename = TAR_FILENAME.format(version=LIBGPIOD_VERSION)
+            tarball_url = f"{SRC_BASE_URL}{tarball_filename}"
+            asc_url = f"{SRC_BASE_URL}{ASC_FILENAME}"
+
+            log.info(f"fetching: {asc_url}")
+
+            asc_filename, _ = urlretrieve(asc_url, path.join(temp_dir, ASC_FILENAME))
+
+            tarball_sha256 = find_sha256sum(asc_filename, tarball_filename)
+
+            if Version(LIBGPIOD_VERSION) < Version(LIBGPIOD_MINIMUM_VERSION):
+                raise BaseError(f"requires libgpiod>={LIBGPIOD_MINIMUM_VERSION}")
+
+            log.info(f"fetching: {tarball_url}")
+
+            downloaded_tarball, _ = urlretrieve(
+                tarball_url, path.join(temp_dir, tarball_filename)
+            )
+
+            log.info(f"verifying: {tarball_filename}")
+            if sha256(downloaded_tarball) != tarball_sha256:
+                raise BaseError(f"signature mismatch for {tarball_filename}")
+
+            # Unpack the downloaded tarball
+            log.info(f"unpacking: {tarball_filename}")
+            with tarfile.open(downloaded_tarball) as f:
+                f.extractall(temp_dir)
+
+            # Copy the include and lib directories we need to build libgpiod
+            base_dir = path.join(temp_dir, f"libgpiod-{LIBGPIOD_VERSION}")
+            copytree(path.join(base_dir, "include"), "./include")
+            copytree(path.join(base_dir, "lib"), "./lib")
+
+        # Save the libgpiod version for sdist
+        open("libgpiod-version.txt", "w").write(LIBGPIOD_VERSION)
+
+        # Run the command
+        command(self)
+
+        # Clean up the build directory
+        rmtree("./lib", ignore_errors=True)
+        rmtree("./include", ignore_errors=True)
+        unlink("libgpiod-version.txt")
+
+    return wrapper
 
 
 class build_ext(orig_build_ext):
     """
-    setuptools install all C extentions even if they're excluded in setup().
-    As a workaround - remove the tests directory right after all extensions
-    were built (and possibly copied to the source directory if inplace is set).
+    Wrap build_ext to amend the module sources and settings to build
+    the bindings and gpiod into a combined module when a version is
+    specified and LINK_SYSTEM_LIBGPIOD=1 is not present in env.
+
+    run is wrapped with @fetch_tarball in order to fetch the sources
+    needed to build binary wheels when LIBGPIOD_VERSION is specified, eg:
+
+    LIBGPIOD_VERSION="2.0.2" python3 -m build .
     """
 
+    @fetch_tarball
     def run(self):
+        # Try to get the gpiod version from the .txt file included in sdist
+        try:
+            libgpiod_version = open("libgpiod-version.txt", "r").read()
+        except OSError:
+            libgpiod_version = LIBGPIOD_VERSION
+
+        if libgpiod_version and not LINK_SYSTEM_LIBGPIOD:
+            # When building the extension from an sdist with a vendored
+            # amend gpiod._ext sources and settings accordingly.
+            gpiod_ext = self.ext_map["gpiod._ext"]
+            gpiod_ext.sources += [
+                "lib/chip.c",
+                "lib/chip-info.c",
+                "lib/edge-event.c",
+                "lib/info-event.c",
+                "lib/internal.c",
+                "lib/line-config.c",
+                "lib/line-info.c",
+                "lib/line-request.c",
+                "lib/line-settings.c",
+                "lib/misc.c",
+                "lib/request-config.c",
+            ]
+            gpiod_ext.libraries = []
+            gpiod_ext.include_dirs = ["include", "lib", "gpiod/ext"]
+            gpiod_ext.extra_compile_args.append(
+                f'-DGPIOD_VERSION_STR="{libgpiod_version}"',
+            )
+
         super().run()
+
+        # We don't ever want the module tests directory in our package
+        # since this might include gpiosim._ext or procname._ext from a
+        # previous dirty build tree.
         rmtree(path.join(self.build_lib, "tests"), ignore_errors=True)
 
 
+class sdist(orig_sdist):
+    """
+    Wrap sdist in order to fetch the libgpiod source files for vendoring
+    into a source distribution.
+
+    run is wrapped with @fetch_tarball in order to fetch the sources
+    needed to build binary wheels when LIBGPIOD_VERSION is specified, eg:
+
+    LIBGPIOD_VERSION="2.0.2" python3 -m build . --sdist
+    """
+
+    @fetch_tarball
+    def run(self):
+        super().run()
+
+
 gpiod_ext = Extension(
     "gpiod._ext",
     sources=[
@@ -50,19 +242,17 @@ procname_ext = Extension(
 )
 
 extensions = [gpiod_ext]
-if environ.get("GPIOD_WITH_TESTS") == "1":
+if GPIOD_WITH_TESTS:
     extensions.append(gpiosim_ext)
     extensions.append(procname_ext)
 
-with open("gpiod/version.py", "r") as fd:
-    exec(fd.read())
-
 setup(
     name="gpiod",
+    url="https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git",
     packages=find_packages(exclude=["tests", "tests.*"]),
     python_requires=">=3.9.0",
     ext_modules=extensions,
-    cmdclass={"build_ext": build_ext},
+    cmdclass={"build_ext": build_ext, "sdist": sdist},
     version=__version__,
     author="Bartosz Golaszewski",
     author_email="brgl@bgdev.pl",
-- 
2.34.1


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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-10-25  8:27 ` [libgpiod][PATCH v9 1/1] " Phil Howard
@ 2023-10-25 12:50   ` Bartosz Golaszewski
  2023-10-25 13:06     ` Kent Gibson
  0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2023-10-25 12:50 UTC (permalink / raw)
  To: Phil Howard, Kent Gibson; +Cc: Linus Walleij, Andy Shevchenko, linux-gpio

On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
>
> 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
> "LIBGPIOD_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 "LIBGPIOD_VERSION" environment variable.
>
> This will instruct setup.py to verify the given version against the list
> in sha256sums.asc and ensure it meets or exceeds a LIBGPIOD_MINIMUM_VERSION
> required for compatibility with the bindings.
>
> It will then 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: LIBGPIOD_VERSION=2.1.0 python3 setup.py sdist
>
> Will build a source distribution with gpiod version 2.1.0 source included.
>
> It will also save the gpiod version into "libgpiod-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@gadgetoid.com>
> ---

This now looks good to me. I'll leave it here until Friday and if
there are no objections (Kent, would you mind reviewing this one?),
I'll apply it to the master branch, do the v2.1 release of libgpiod,
then create the v2.1.0 release of python bindings (with sdist
packaging libgpiod v2.1) and upload it to gpiod @ pypi. Hopefully this
will work correctly.

Bart

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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-10-25 12:50   ` Bartosz Golaszewski
@ 2023-10-25 13:06     ` Kent Gibson
  2023-10-26  9:29       ` Bartosz Golaszewski
  0 siblings, 1 reply; 9+ messages in thread
From: Kent Gibson @ 2023-10-25 13:06 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Phil Howard, Linus Walleij, Andy Shevchenko, linux-gpio

On Wed, Oct 25, 2023 at 02:50:57PM +0200, Bartosz Golaszewski wrote:
> On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
> >
>
> This now looks good to me. I'll leave it here until Friday and if
> there are no objections (Kent, would you mind reviewing this one?),

I've got nothing to add.

Cheers,
Kent.


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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-10-25 13:06     ` Kent Gibson
@ 2023-10-26  9:29       ` Bartosz Golaszewski
  2023-11-03  8:56         ` Phil Howard
  0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2023-10-26  9:29 UTC (permalink / raw)
  To: Kent Gibson, Phil Howard; +Cc: Linus Walleij, Andy Shevchenko, linux-gpio

On Wed, Oct 25, 2023 at 3:06 PM Kent Gibson <warthog618@gmail.com> wrote:
>
> On Wed, Oct 25, 2023 at 02:50:57PM +0200, Bartosz Golaszewski wrote:
> > On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
> > >
> >
> > This now looks good to me. I'll leave it here until Friday and if
> > there are no objections (Kent, would you mind reviewing this one?),
>
> I've got nothing to add.
>
> Cheers,
> Kent.
>

Ok, I will actually delay it for a week until next Friday because I'll
be off Mon-Thu and I don't want to leave stuff broken if anything goes
wrong.

Bart

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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-10-26  9:29       ` Bartosz Golaszewski
@ 2023-11-03  8:56         ` Phil Howard
  2023-11-03  9:06           ` Bartosz Golaszewski
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Howard @ 2023-11-03  8:56 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Kent Gibson, Linus Walleij, Andy Shevchenko, linux-gpio

So, today's the day?

What's the plan?

On Thu, 26 Oct 2023 at 10:29, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Wed, Oct 25, 2023 at 3:06 PM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > On Wed, Oct 25, 2023 at 02:50:57PM +0200, Bartosz Golaszewski wrote:
> > > On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
> > > >
> > >
> > > This now looks good to me. I'll leave it here until Friday and if
> > > there are no objections (Kent, would you mind reviewing this one?),
> >
> > I've got nothing to add.
> >
> > Cheers,
> > Kent.
> >
>
> Ok, I will actually delay it for a week until next Friday because I'll
> be off Mon-Thu and I don't want to leave stuff broken if anything goes
> wrong.
>
> Bart



-- 
Philip Howard
Technology & Lifestyle Writer
gadgetoid.com

Gadgetoid gadg-et-oid [gaj-it-oid]

                                     -adjective

1. having the characteristics or form of a gadget; resembling a
mechanical contrivance or device.

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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-11-03  8:56         ` Phil Howard
@ 2023-11-03  9:06           ` Bartosz Golaszewski
  2023-11-03  9:31             ` Phil Howard
  0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2023-11-03  9:06 UTC (permalink / raw)
  To: Phil Howard; +Cc: Kent Gibson, Linus Walleij, Andy Shevchenko, linux-gpio

On Fri, Nov 3, 2023 at 9:56 AM Phil Howard <phil@gadgetoid.com> wrote:
>
> So, today's the day?
>
> What's the plan?
>

Yes! I'll apply this, release libgpiod v2.1, generate the python
v2.1.0 release from it and upload it to pypi - this time to the gpiod
package.

Bart

> On Thu, 26 Oct 2023 at 10:29, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Wed, Oct 25, 2023 at 3:06 PM Kent Gibson <warthog618@gmail.com> wrote:
> > >
> > > On Wed, Oct 25, 2023 at 02:50:57PM +0200, Bartosz Golaszewski wrote:
> > > > On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
> > > > >
> > > >
> > > > This now looks good to me. I'll leave it here until Friday and if
> > > > there are no objections (Kent, would you mind reviewing this one?),
> > >
> > > I've got nothing to add.
> > >
> > > Cheers,
> > > Kent.
> > >
> >
> > Ok, I will actually delay it for a week until next Friday because I'll
> > be off Mon-Thu and I don't want to leave stuff broken if anything goes
> > wrong.
> >
> > Bart
>
>
>
> --
> Philip Howard
> Technology & Lifestyle Writer
> gadgetoid.com
>
> Gadgetoid gadg-et-oid [gaj-it-oid]
>
>                                      -adjective
>
> 1. having the characteristics or form of a gadget; resembling a
> mechanical contrivance or device.

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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-11-03  9:06           ` Bartosz Golaszewski
@ 2023-11-03  9:31             ` Phil Howard
  2023-11-03 10:32               ` Bartosz Golaszewski
  0 siblings, 1 reply; 9+ messages in thread
From: Phil Howard @ 2023-11-03  9:31 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Kent Gibson, Linus Walleij, Andy Shevchenko, linux-gpio

A quick aside, if modified to run on your system, does this script segfault?

```

import gpiod
from gpiod.line import Direction, Value

a = gpiod.request_lines("/dev/gpiochip0", consumer="test", config={
    23: gpiod.LineSettings(direction=Direction.OUTPUT,
output_value=Value.INACTIVE)
})

b = gpiod.request_lines("/dev/gpiochip0", consumer="test", config={
    24: gpiod.LineSettings(direction=Direction.OUTPUT,
output_value=Value.INACTIVE)
})

a.release()
b.release()
```


On Fri, 3 Nov 2023 at 09:06, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Fri, Nov 3, 2023 at 9:56 AM Phil Howard <phil@gadgetoid.com> wrote:
> >
> > So, today's the day?
> >
> > What's the plan?
> >
>
> Yes! I'll apply this, release libgpiod v2.1, generate the python
> v2.1.0 release from it and upload it to pypi - this time to the gpiod
> package.
>
> Bart
>
> > On Thu, 26 Oct 2023 at 10:29, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > On Wed, Oct 25, 2023 at 3:06 PM Kent Gibson <warthog618@gmail.com> wrote:
> > > >
> > > > On Wed, Oct 25, 2023 at 02:50:57PM +0200, Bartosz Golaszewski wrote:
> > > > > On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
> > > > > >
> > > > >
> > > > > This now looks good to me. I'll leave it here until Friday and if
> > > > > there are no objections (Kent, would you mind reviewing this one?),
> > > >
> > > > I've got nothing to add.
> > > >
> > > > Cheers,
> > > > Kent.
> > > >
> > >
> > > Ok, I will actually delay it for a week until next Friday because I'll
> > > be off Mon-Thu and I don't want to leave stuff broken if anything goes
> > > wrong.
> > >
> > > Bart
> >
> >
> >
> > --
> > Philip Howard
> > Technology & Lifestyle Writer
> > gadgetoid.com
> >
> > Gadgetoid gadg-et-oid [gaj-it-oid]
> >
> >                                      -adjective
> >
> > 1. having the characteristics or form of a gadget; resembling a
> > mechanical contrivance or device.

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

* Re: [libgpiod][PATCH v9 1/1] bindings: python: optionally include module in sdist
  2023-11-03  9:31             ` Phil Howard
@ 2023-11-03 10:32               ` Bartosz Golaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2023-11-03 10:32 UTC (permalink / raw)
  To: Phil Howard; +Cc: Kent Gibson, Linus Walleij, Andy Shevchenko, linux-gpio

On Fri, Nov 3, 2023 at 10:31 AM Phil Howard <phil@gadgetoid.com> wrote:
>
> A quick aside, if modified to run on your system, does this script segfault?
>
> ```
>
> import gpiod
> from gpiod.line import Direction, Value
>
> a = gpiod.request_lines("/dev/gpiochip0", consumer="test", config={
>     23: gpiod.LineSettings(direction=Direction.OUTPUT,
> output_value=Value.INACTIVE)
> })
>
> b = gpiod.request_lines("/dev/gpiochip0", consumer="test", config={
>     24: gpiod.LineSettings(direction=Direction.OUTPUT,
> output_value=Value.INACTIVE)
> })
>
> a.release()
> b.release()
> ```

Nope, works fine. What is the stack trace?

Bartosz

>
>
> On Fri, 3 Nov 2023 at 09:06, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > On Fri, Nov 3, 2023 at 9:56 AM Phil Howard <phil@gadgetoid.com> wrote:
> > >
> > > So, today's the day?
> > >
> > > What's the plan?
> > >
> >
> > Yes! I'll apply this, release libgpiod v2.1, generate the python
> > v2.1.0 release from it and upload it to pypi - this time to the gpiod
> > package.
> >
> > Bart
> >
> > > On Thu, 26 Oct 2023 at 10:29, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > >
> > > > On Wed, Oct 25, 2023 at 3:06 PM Kent Gibson <warthog618@gmail.com> wrote:
> > > > >
> > > > > On Wed, Oct 25, 2023 at 02:50:57PM +0200, Bartosz Golaszewski wrote:
> > > > > > On Wed, Oct 25, 2023 at 10:27 AM Phil Howard <phil@gadgetoid.com> wrote:
> > > > > > >
> > > > > >
> > > > > > This now looks good to me. I'll leave it here until Friday and if
> > > > > > there are no objections (Kent, would you mind reviewing this one?),
> > > > >
> > > > > I've got nothing to add.
> > > > >
> > > > > Cheers,
> > > > > Kent.
> > > > >
> > > >
> > > > Ok, I will actually delay it for a week until next Friday because I'll
> > > > be off Mon-Thu and I don't want to leave stuff broken if anything goes
> > > > wrong.
> > > >
> > > > Bart
> > >
> > >
> > >
> > > --
> > > Philip Howard
> > > Technology & Lifestyle Writer
> > > gadgetoid.com
> > >
> > > Gadgetoid gadg-et-oid [gaj-it-oid]
> > >
> > >                                      -adjective
> > >
> > > 1. having the characteristics or form of a gadget; resembling a
> > > mechanical contrivance or device.

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

end of thread, other threads:[~2023-11-03 10:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25  8:27 [libgpiod][PATCH v9 0/1] bindings: python: optionally include module in sdist Phil Howard
2023-10-25  8:27 ` [libgpiod][PATCH v9 1/1] " Phil Howard
2023-10-25 12:50   ` Bartosz Golaszewski
2023-10-25 13:06     ` Kent Gibson
2023-10-26  9:29       ` Bartosz Golaszewski
2023-11-03  8:56         ` Phil Howard
2023-11-03  9:06           ` Bartosz Golaszewski
2023-11-03  9:31             ` Phil Howard
2023-11-03 10:32               ` Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.