Merge pull request #155625 from sternenseemann/python-sigrok-0.5.1

python3Packages.sigrok: init at 0.5.1
This commit is contained in:
Robert Scott 2022-01-23 15:47:49 +00:00 committed by GitHub
commit 10a547c8f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 86 additions and 3 deletions

View file

@ -0,0 +1,62 @@
{ lib
, stdenv
, libsigrok
, toPythonModule
, python
, autoreconfHook
, pythonImportsCheckHook
, pythonCatchConflictsHook
, swig
, setuptools
, numpy
, pygobject3
}:
# build libsigrok plus its Python bindings. Unfortunately it does not appear
# to be possible to build them separately, at least not easily.
toPythonModule ((libsigrok.override {
inherit python;
}).overrideAttrs (orig: {
pname = "${python.libPrefix}-sigrok";
patches = orig.patches or [] ++ [
# Makes libsigrok install the bindings into site-packages properly (like
# we expect) instead of making a version-specific *.egg subdirectory.
./python-install.patch
];
nativeBuildInputs = orig.nativeBuildInputs or [] ++ [
autoreconfHook
setuptools
swig
numpy
] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
pythonImportsCheckHook
pythonCatchConflictsHook
];
buildInputs = orig.buildInputs or [] ++ [
pygobject3 # makes headers available the configure script checks for
];
propagatedBuildInputs = orig.propagatedBuildInputs or [] ++ [
pygobject3
numpy
];
postInstall = ''
${orig.postInstall or ""}
# for pythonImportsCheck
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
'';
pythonImportsCheck = [ "sigrok" "sigrok.core" ];
meta = orig.meta // {
description = "Python bindings for libsigrok";
maintainers = orig.meta.maintainers ++ [
lib.maintainers.sternenseemann
];
};
}))

View file

@ -0,0 +1,16 @@
diff --git a/Makefile.am b/Makefile.am
index 280cf64d..e10eb79f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -888,8 +888,9 @@ $(PDIR)/timestamp: $(PDIR)/sigrok/core/classes.i \
python-install:
$(AM_V_at)$(MKDIR_P) "$(DESTDIR)$(prefix)" "$(DESTDIR)$(exec_prefix)"
- destdir='$(DESTDIR)'; $(setup_py) install $${destdir:+"--root=$$destdir"} \
- --prefix "$(prefix)" --exec-prefix "$(exec_prefix)"
+ destdir='$(DESTDIR)'; $(setup_py) install --root=$${destdir:-/} \
+ --prefix "$(prefix)" --exec-prefix "$(exec_prefix)" \
+ --single-version-externally-managed
python-clean:
-$(AM_V_at)rm -f $(PDIR)/timestamp

View file

@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, pkg-config, libzip, glib, libusb1, libftdi1, check
, libserialport, librevisa, doxygen, glibmm, python3
, libserialport, librevisa, doxygen, glibmm, python
, version ? "0.5.1", sha256 ? "171b553dir5gn6w4f7n37waqk62nq2kf1jykx4ifjacdz5xdw3z4", doInstallCheck ? true
}:
@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
sha256 = "14sd8xqph4kb109g073daiavpadb20fcz7ch1ipn0waz7nlly4sw";
};
nativeBuildInputs = [ doxygen pkg-config python3 ];
nativeBuildInputs = [ doxygen pkg-config python ];
buildInputs = [ libzip glib libusb1 libftdi1 check libserialport librevisa glibmm ];
strictDeps = true;

View file

@ -14544,9 +14544,12 @@ with pkgs;
libstdcxx5 = callPackage ../development/libraries/gcc/libstdc++/5.nix { };
libsigrok = callPackage ../development/tools/libsigrok { };
libsigrok = callPackage ../development/tools/libsigrok {
python = python3;
};
# old version:
libsigrok_0_3 = libsigrok.override {
python = python3;
version = "0.3.0";
sha256 = "0l3h7zvn3w4c1b9dgvl3hirc4aj1csfkgbk87jkpl7bgl03nk4j3";
doInstallCheck = false;

View file

@ -8950,6 +8950,8 @@ in {
signedjson = callPackage ../development/python-modules/signedjson { };
sigrok = callPackage ../development/python-modules/sigrok { };
sigtools = callPackage ../development/python-modules/sigtools { };
simanneal = callPackage ../development/python-modules/simanneal { };