python3Packages.xmlsec: fix build with xmlsec ≥1.3.11

This commit is contained in:
whispers
2026-09-06 18:40:50 -04:00
parent 57a511fb32
commit fcce7ff567
2 changed files with 45 additions and 26 deletions

View File

@@ -9,6 +9,7 @@
openssl,
nss,
lib,
python3Packages,
runCommandCC,
writeText,
}:
@@ -76,34 +77,37 @@ stdenv.mkDerivation (finalAttrs: {
moveToOutput "lib/xmlsec1Conf.sh" "$dev"
'';
passthru.tests.libxmlsec1-crypto =
runCommandCC "libxmlsec1-crypto-test"
{
nativeBuildInputs = [ pkg-config ];
buildInputs = [
finalAttrs.finalPackage
libxml2
libxslt
libtool
];
}
''
$CC $(pkg-config --cflags --libs xmlsec1) -o crypto-test ${writeText "crypto-test.c" ''
#include <xmlsec/xmlsec.h>
#include <xmlsec/crypto.h>
passthru.tests = {
python-xmlsec = python3Packages.xmlsec;
libxmlsec1-crypto =
runCommandCC "libxmlsec1-crypto-test"
{
nativeBuildInputs = [ pkg-config ];
buildInputs = [
finalAttrs.finalPackage
libxml2
libxslt
libtool
];
}
''
$CC $(pkg-config --cflags --libs xmlsec1) -o crypto-test ${writeText "crypto-test.c" ''
#include <xmlsec/xmlsec.h>
#include <xmlsec/crypto.h>
int main(int argc, char **argv) {
return xmlSecInit() ||
xmlSecCryptoDLLoadLibrary(argc > 1 ? argv[1] : 0) ||
xmlSecCryptoInit();
}
''}
int main(int argc, char **argv) {
return xmlSecInit() ||
xmlSecCryptoDLLoadLibrary(argc > 1 ? argv[1] : 0) ||
xmlSecCryptoInit();
}
''}
for crypto in "" gnutls nss openssl; do
./crypto-test $crypto
done
touch $out
'';
for crypto in "" gnutls nss openssl; do
./crypto-test $crypto
done
touch $out
'';
};
meta = {
description = "XML Security Library in C based on libxml2";

View File

@@ -3,6 +3,7 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# build-system
pkgconfig,
@@ -38,6 +39,20 @@ buildPythonPackage (finalAttrs: {
hash = "sha256-p3V75DLUI2PKdharP3/0HrKOgma9Kh3lAOZLRAQjo80=";
};
patches = [
# https://github.com/lsh123/xmlsec/issues/1148
# https://github.com/xmlsec/python-xmlsec/pull/422
(fetchpatch {
name = "xmlsec-1.3.11-test-compatibility.patch";
url = "https://github.com/xmlsec/python-xmlsec/commit/5e8b4e6aa133c358b8aaf8e17ceb5b3b7fea78e8.patch";
includes = [
"src/*"
"tests/*"
];
hash = "sha256-+J2L6oq802/534qIDvFqsWYfn9LExRlXXIeDvVqZEYk=";
})
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "lxml==" "lxml>=" \