mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-09 06:23:36 +00:00
Merge pull request #276717 from K900/lxml-fix-next
python311Packages.lxml: 4.9.3-3 -> 4.9.4, backport libxml 2.12 build fix
This commit is contained in:
commit
694164b65e
@ -8,16 +8,22 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "lxml";
|
||||
version = "4.9.3-3";
|
||||
version = "4.9.4";
|
||||
format = "setuptools";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = pname;
|
||||
repo = pname;
|
||||
rev = "refs/tags/lxml-${version}";
|
||||
hash = "sha256-Vrizi+6jUUEx7qODU4PAH5ZmvBIyT9H18+QpYB0m1f4=";
|
||||
hash = "sha256-qS20wb83eFapiPZe25BViHpYkjgvnCIZpiYkPNIPHZg=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# fix compile error with libxml 2.12
|
||||
# backport of: https://github.com/lxml/lxml/commit/b0861bea17769584a85f57eb00235ce0ca9811af
|
||||
./libxml-2.12.patch
|
||||
];
|
||||
|
||||
# setuptoolsBuildPhase needs dependencies to be passed through nativeBuildInputs
|
||||
nativeBuildInputs = [ libxml2.dev libxslt.dev cython ] ++ lib.optionals stdenv.isDarwin [ xcodebuild ];
|
||||
buildInputs = [ libxml2 libxslt zlib ];
|
||||
|
94
pkgs/development/python-modules/lxml/libxml-2.12.patch
Normal file
94
pkgs/development/python-modules/lxml/libxml-2.12.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From 3b8807306d79d2ae2e9fa28c5ecd3b40b32ee65b Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Behnel <stefan_ml@behnel.de>
|
||||
Date: Wed, 29 Nov 2023 10:28:47 +0100
|
||||
Subject: [PATCH] Follow changes in libxml2 2.12 and make xmlError usages
|
||||
'const'. This mostly impacts the error callback functions.
|
||||
|
||||
---
|
||||
src/lxml/extensions.pxi | 4 ++--
|
||||
src/lxml/parser.pxi | 4 ++--
|
||||
src/lxml/xmlerror.pxi | 8 ++++----
|
||||
3 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/lxml/extensions.pxi b/src/lxml/extensions.pxi
|
||||
index 35a321b7..42b4c4f6 100644
|
||||
--- a/src/lxml/extensions.pxi
|
||||
+++ b/src/lxml/extensions.pxi
|
||||
@@ -393,7 +393,7 @@ cdef tuple LIBXML2_XPATH_ERROR_MESSAGES = (
|
||||
b"?? Unknown error ??\n",
|
||||
)
|
||||
|
||||
-cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil:
|
||||
+cdef void _forwardXPathError(void* c_ctxt, const xmlerror.xmlError* c_error) with gil:
|
||||
cdef xmlerror.xmlError error
|
||||
cdef int xpath_code
|
||||
if c_error.message is not NULL:
|
||||
@@ -414,7 +414,7 @@ cdef void _forwardXPathError(void* c_ctxt, xmlerror.xmlError* c_error) with gil:
|
||||
|
||||
(<_BaseContext>c_ctxt)._error_log._receive(&error)
|
||||
|
||||
-cdef void _receiveXPathError(void* c_context, xmlerror.xmlError* error) nogil:
|
||||
+cdef void _receiveXPathError(void* c_context, const xmlerror.xmlError* error) nogil:
|
||||
if not __DEBUG:
|
||||
return
|
||||
if c_context is NULL:
|
||||
diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi
|
||||
index 22463c7d..1566b6df 100644
|
||||
--- a/src/lxml/parser.pxi
|
||||
+++ b/src/lxml/parser.pxi
|
||||
@@ -626,10 +626,10 @@ cdef _initParserContext(_ParserContext context,
|
||||
if c_ctxt is not NULL:
|
||||
context._initParserContext(c_ctxt)
|
||||
|
||||
-cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, xmlerror.xmlError* error) with gil:
|
||||
+cdef void _forwardParserError(xmlparser.xmlParserCtxt* _parser_context, const xmlerror.xmlError* error) with gil:
|
||||
(<_ParserContext>_parser_context._private)._error_log._receive(error)
|
||||
|
||||
-cdef void _receiveParserError(void* c_context, xmlerror.xmlError* error) nogil:
|
||||
+cdef void _receiveParserError(void* c_context, const xmlerror.xmlError* error) nogil:
|
||||
if __DEBUG:
|
||||
if c_context is NULL or (<xmlparser.xmlParserCtxt*>c_context)._private is NULL:
|
||||
_forwardError(NULL, error)
|
||||
diff --git a/src/lxml/xmlerror.pxi b/src/lxml/xmlerror.pxi
|
||||
index 1b50444f..4cd745f9 100644
|
||||
--- a/src/lxml/xmlerror.pxi
|
||||
+++ b/src/lxml/xmlerror.pxi
|
||||
@@ -66,7 +66,7 @@ cdef class _LogEntry:
|
||||
tree.xmlFree(self._c_path)
|
||||
|
||||
@cython.final
|
||||
- cdef _setError(self, xmlerror.xmlError* error):
|
||||
+ cdef _setError(self, const xmlerror.xmlError* error):
|
||||
self.domain = error.domain
|
||||
self.type = error.code
|
||||
self.level = <int>error.level
|
||||
@@ -198,7 +198,7 @@ cdef class _BaseErrorLog:
|
||||
pass
|
||||
|
||||
@cython.final
|
||||
- cdef void _receive(self, xmlerror.xmlError* error):
|
||||
+ cdef void _receive(self, const xmlerror.xmlError* error):
|
||||
cdef bint is_error
|
||||
cdef _LogEntry entry
|
||||
cdef _BaseErrorLog global_log
|
||||
@@ -634,7 +634,7 @@ def use_global_python_log(PyErrorLog log not None):
|
||||
|
||||
|
||||
# local log functions: forward error to logger object
|
||||
-cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:
|
||||
+cdef void _forwardError(void* c_log_handler, const xmlerror.xmlError* error) with gil:
|
||||
cdef _BaseErrorLog log_handler
|
||||
if c_log_handler is not NULL:
|
||||
log_handler = <_BaseErrorLog>c_log_handler
|
||||
@@ -645,7 +645,7 @@ cdef void _forwardError(void* c_log_handler, xmlerror.xmlError* error) with gil:
|
||||
log_handler._receive(error)
|
||||
|
||||
|
||||
-cdef void _receiveError(void* c_log_handler, xmlerror.xmlError* error) nogil:
|
||||
+cdef void _receiveError(void* c_log_handler, const xmlerror.xmlError* error) nogil:
|
||||
# no Python objects here, may be called without thread context !
|
||||
if __DEBUG:
|
||||
_forwardError(c_log_handler, error)
|
||||
--
|
||||
2.42.0
|
||||
|
Loading…
Reference in New Issue
Block a user