libgpiod: fix Python bindings
libgpiod's Python bindings no longer worked after the upgrade to 2.0.1. The build system installs an egg, which doesn't work in nixpkgs. To fix this, I adopted the same approach I took in #204884. This patch builds the Python bindings as a separate package, using the normal nixpkgs Python infrastructure. Besides fixing the bindings, this has the added benefit of avoiding the need to build a redundant copy of libgpiod as part of the Python bindings package. Lastly, I cleaned up the libgpiod package a bit, removing an unused dependency on kmod and an unnecessary configure flag. I also added the full list of licenses that apply to the package.
This commit is contained in:
parent
97bd658852
commit
6421f070e3
|
@ -1,6 +1,5 @@
|
||||||
{ lib, stdenv, fetchurl, autoreconfHook, autoconf-archive, pkg-config, kmod
|
{ lib, stdenv, fetchurl, autoreconfHook, autoconf-archive, pkg-config
|
||||||
, enable-tools ? true
|
, enable-tools ? true }:
|
||||||
, enablePython ? false, python3, ncurses }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "libgpiod";
|
pname = "libgpiod";
|
||||||
|
@ -11,7 +10,6 @@ stdenv.mkDerivation rec {
|
||||||
hash = "sha256-tu2lU1YWCo5zkG49SOlZ74EpZ4fXZJdbEPJX6WYGaOk=";
|
hash = "sha256-tu2lU1YWCo5zkG49SOlZ74EpZ4fXZJdbEPJX6WYGaOk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ kmod ] ++ lib.optionals enablePython [ python3 ncurses ];
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
autoconf-archive
|
autoconf-archive
|
||||||
pkg-config
|
pkg-config
|
||||||
|
@ -21,8 +19,7 @@ stdenv.mkDerivation rec {
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--enable-tools=${if enable-tools then "yes" else "no"}"
|
"--enable-tools=${if enable-tools then "yes" else "no"}"
|
||||||
"--enable-bindings-cxx"
|
"--enable-bindings-cxx"
|
||||||
"--prefix=${placeholder "out"}"
|
];
|
||||||
] ++ lib.optional enablePython "--enable-bindings-python";
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "C library and tools for interacting with the linux GPIO character device";
|
description = "C library and tools for interacting with the linux GPIO character device";
|
||||||
|
@ -32,7 +29,10 @@ stdenv.mkDerivation rec {
|
||||||
data structures behind a straightforward API.
|
data structures behind a straightforward API.
|
||||||
'';
|
'';
|
||||||
homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/";
|
homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/";
|
||||||
license = licenses.lgpl2;
|
license = with licenses; [
|
||||||
|
lgpl21Plus # libgpiod
|
||||||
|
lgpl3Plus # C++ bindings
|
||||||
|
] ++ lib.optional enable-tools gpl2Plus;
|
||||||
maintainers = [ maintainers.expipiplus1 ];
|
maintainers = [ maintainers.expipiplus1 ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
|
|
25
pkgs/development/python-modules/libgpiod/default.nix
Normal file
25
pkgs/development/python-modules/libgpiod/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ lib
|
||||||
|
, buildPythonPackage
|
||||||
|
, libgpiod
|
||||||
|
}:
|
||||||
|
buildPythonPackage {
|
||||||
|
inherit (libgpiod) pname version src;
|
||||||
|
format = "setuptools";
|
||||||
|
|
||||||
|
buildInputs = [ libgpiod ];
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
|
cd bindings/python
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Requires libgpiod built with --enable-tests
|
||||||
|
doCheck = false;
|
||||||
|
pythonImportsCheck = [ "gpiod" ];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Python bindings for libgpiod";
|
||||||
|
homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/";
|
||||||
|
license = licenses.lgpl21Plus;
|
||||||
|
maintainers = with maintainers; [ lopsided98 ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -5846,10 +5846,9 @@ self: super: with self; {
|
||||||
pythonSupport = true;
|
pythonSupport = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
libgpiod = toPythonModule (pkgs.libgpiod.override {
|
libgpiod = callPackage ../development/python-modules/libgpiod {
|
||||||
enablePython = true;
|
inherit (pkgs) libgpiod;
|
||||||
python3 = python;
|
};
|
||||||
});
|
|
||||||
|
|
||||||
libgpuarray = callPackage ../development/python-modules/libgpuarray {
|
libgpuarray = callPackage ../development/python-modules/libgpuarray {
|
||||||
clblas = pkgs.clblas.override { inherit (self) boost; };
|
clblas = pkgs.clblas.override { inherit (self) boost; };
|
||||||
|
|
Loading…
Reference in a new issue