python312Packages.gpgme: build out of tree

This commit is contained in:
Robert Schütz
2024-11-23 12:05:51 -08:00
parent b3797b6d48
commit 29c88a0ce6
4 changed files with 60 additions and 35 deletions
+6 -31
View File
@@ -10,12 +10,9 @@
pth,
libassuan,
which,
ncurses,
texinfo,
buildPackages,
qtbase ? null,
pythonSupport ? false,
swig ? null,
# only for passthru.tests
libsForQt5,
qt6Packages,
@@ -41,8 +38,6 @@ stdenv.mkDerivation rec {
};
patches = [
# Support Python 3.13
./python313-support.patch
# Fix a test after disallowing compressed signatures in gpg (PR #180336)
./test_t-verify_double-plaintext.patch
# Don't use deprecated LFS64 APIs (removed in musl 1.2.4)
@@ -50,31 +45,12 @@ stdenv.mkDerivation rec {
./LFS64.patch
];
postPatch = ''
# autoconf's beta detection requires a git repo to work
# and otherwise appends -unknown to the version number used in the python package which pip stumbles upon
substituteInPlace autogen.sh \
--replace-fail 'tmp="-unknown"' 'tmp=""'
'';
nativeBuildInputs =
[
autoreconfHook
gnupg
pkg-config
texinfo
]
++ lib.optionals pythonSupport [
python3.pythonOnBuildForHost
python3.pkgs.pip
python3.pkgs.setuptools
python3.pkgs.wheel
ncurses
swig
which
];
buildInputs = lib.optionals pythonSupport [ python3 ];
nativeBuildInputs = [
autoreconfHook
gnupg
pkg-config
texinfo
];
propagatedBuildInputs = [
glib
@@ -95,7 +71,6 @@ stdenv.mkDerivation rec {
"--with-libgpg-error-prefix=${libgpg-error.dev}"
"--with-libassuan-prefix=${libassuan.dev}"
]
++ lib.optional pythonSupport "--enable-languages=python"
# Tests will try to communicate with gpg-agent instance via a UNIX socket
# which has a path length limit. Nix on darwin is using a build directory
# that already has quite a long path and the resulting socket path doesn't
@@ -0,0 +1,51 @@
{
buildPythonPackage,
gpgme,
lib,
setuptools,
swig,
}:
buildPythonPackage {
pname = "gpgme";
inherit (gpgme) version src;
pyproject = true;
patches = gpgme.patches or [ ] ++ [
./python313-support.patch
];
postPatch = ''
substituteInPlace lang/python/setup.py.in \
--replace-fail "gpgme_h = '''" "gpgme_h = '${lib.getDev gpgme}/include/gpgme.h'"
'';
configureFlags = gpgme.configureFlags ++ [
"--enable-languages=python"
];
postConfigure = "
cd lang/python
";
preBuild = ''
make copystamp
'';
build-system = [ setuptools ];
nativeBuildInputs = [
swig
];
buildInputs = [
gpgme
];
pythonImportsCheck = [ "gpg" ];
meta = gpgme.meta // {
description = "Python bindings to the GPGME API of the GnuPG cryptography library";
homepage = "https://dev.gnupg.org/source/gpgme/browse/master/lang/python/";
};
}
+3 -4
View File
@@ -5421,10 +5421,9 @@ self: super: with self; {
gplaycli = callPackage ../development/python-modules/gplaycli { };
gpgme = toPythonModule (pkgs.gpgme.override {
pythonSupport = true;
python3 = python;
});
gpgme = callPackage ../development/python-modules/gpgme {
inherit (pkgs) gpgme;
};
gphoto2 = callPackage ../development/python-modules/gphoto2 { };