python3Packages.gpgme: 1.24.3 -> 2.0.0 (#464823)

This commit is contained in:
dotlambda
2025-11-25 15:18:25 +00:00
committed by GitHub
@@ -1,52 +1,72 @@
{
autoreconfHook,
buildPythonPackage,
fetchurl,
gnupg,
gpgme,
lib,
libgpg-error,
setuptools,
swig,
}:
buildPythonPackage {
buildPythonPackage rec {
pname = "gpgme";
inherit (gpgme) version src;
version = "2.0.0";
pyproject = true;
patches = gpgme.patches or [ ];
src = fetchurl {
url = "mirror://gnupg/gpgmepy/gpgmepy-${version}.tar.bz2";
hash = "sha256-B+EmVkj/UdojjJr3oYs/HcewxmtPIacvJ8dLOWzTM20=";
};
postPatch = ''
substituteInPlace lang/python/setup.py.in \
--replace-fail "gpgme_h = '''" "gpgme_h = '${lib.getDev gpgme}/include/gpgme.h'" \
--replace-fail "@VERSION@" "${gpgme.version}"
'';
substituteInPlace pyproject.toml \
--replace-fail ', "swig"' ""
configureFlags = gpgme.configureFlags ++ [
"--enable-languages=python"
];
postConfigure = "
cd lang/python
";
preBuild = ''
make copystamp
# prevent `packaging.version.InvalidVersion: Invalid version: '2.0.0-unknown'`
substituteInPlace autogen.sh \
--replace-fail 'tmp="-unknown"' 'tmp=""'
'';
build-system = [ setuptools ];
nativeBuildInputs = [
autoreconfHook
gpgme # for gpgme-config
libgpg-error # for gpg-error-config
swig
];
preBuild = ''
# prevent `error: package directory 'gpg' does not exist`
mv src gpg
'';
buildInputs = [
gpgme
libgpg-error
];
pythonImportsCheck = [ "gpg" ];
meta = gpgme.meta // {
nativeCheckInputs = [
gnupg
];
checkPhase = ''
runHook preCheck
make -C tests
runHook postCheck
'';
meta = {
changelog = "https://dev.gnupg.org/source/gpgmepy/browse/master/NEWS;gpgmepy-${version}?as=remarkup";
description = "Python bindings to the GPGME API of the GnuPG cryptography library";
homepage = "https://dev.gnupg.org/source/gpgme/browse/master/lang/python/";
homepage = "https://dev.gnupg.org/source/gpgmepy/";
license = lib.licenses.lgpl21Plus;
maintainers = [ lib.maintainers.dotlambda ];
};
}