Project

General

Profile

Actions

Bug #6538

closed

lxml and py-lxml issues with __xmlStructuredErrorContext not being global

Added by Richard PALO almost 6 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-12-31
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

pfexec pip-2.7 install lxml


Files

0001-update-to-pylxml-3.5.0.patch (14.4 KB) 0001-update-to-pylxml-3.5.0.patch patchset upgrading to pylxml-3.5.0 Richard PALO, 2016-01-03 05:55 AM
Actions #1

Updated by Richard PALO almost 6 years ago

That wasn't quite all

$ LANG=C python2.7
Python 2.7.11 (default, Dec  9 2015, 12:53:36) 
[GCC 4.9.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: ld.so.1: isapython2.7: fatal: relocation error: file /usr/lib/python2.7/site-packages/lxml/etree.so: symbol __xmlStructuredErrorContext: referenced symbol not found

on OI, elfdump -s indeed shows the above as a local function, whereas in pkgsrc we have a global.

I believe there is at least one simple problem in the mapfile where 'xmlStructuredErrorContext'
is made global instead of '__xmlStructuredErrorContext'

The global functions can be identified by searching XMLPUBFUN in /usr/include/libxml2/libxml/globals.h
and the global variables via XMLPUBVAR.

Actions #2

Updated by Richard PALO almost 6 years ago

btw, it would be useful to ship the updated lxml python package (min 3.3.5), this probably would have shown up in tests.

Actions #3

Updated by Richard PALO almost 6 years ago

Not very accustomed to oi-userland, but gave the upgrade a try and the tests seem to finally work
when libxml2 has the following very minimal patch applied and installed:

diff --git a/components/libxml2/mapfile b/components/libxml2/mapfile
index fbb1116..ae46b65 100644
--- a/components/libxml2/mapfile
+++ b/components/libxml2/mapfile
@@ -80,6 +80,7 @@ SYMBOL_VERSION SUNW_1.8 {
                xmlSchemaValidCtxtGetParserCtxt;
                xmlSchematronSetValidStructuredErrors;
                xmlStructuredErrorContext;
+               __xmlStructuredErrorContext;
                xmlXIncludeProcessTreeFlagsData;
 } SUNW_1.7;

the mapfile should be correctly updated (at some time) though.

note that to be really useful, in addition to this pylxml update,
cssselect>=0.7 and html5lib need to be added/installed (worst case via site-packages)

Actions #4

Updated by Richard PALO almost 6 years ago

I was noticing the following in the test output:

/home/richard/src/oi-userland/components/python/pylxml/lxml-3.5.0/src/lxml/html/__init__.py:54: RuntimeWarning: compiletime version 2.6 of module 'lxml.etree' does not match runtime version 2.7
and
/home/richard/src/oi-userland/components/python/pylxml/lxml-3.5.0/src/lxml/tests/test_objectify.py:18: RuntimeWarning: compiletime version 2.6 of module 'lxml.objectify' does not match runtime version 2.7

Not sure if this is appropriate for oi-userland, but this seemed to get over those warnings:

richard@devzone:~/src/oi-userland/components/python/pylxml$ git diff .
diff --git a/components/python/pylxml/Makefile b/components/python/pylxml/Makefile
index 24f14e8..1a3e29c 100644
--- a/components/python/pylxml/Makefile
+++ b/components/python/pylxml/Makefile
@@ -49,6 +49,8 @@ COMPONENT_TEST_ARGS=  test
 COMPONENT_TEST_CMD=    $(MAKE)
 COMPONENT_TEST_DIR=    $(COMPONENT_SRC)
 COMPONENT_TEST_ENV+=   PYTHON=$(PYTHON)
+# testsuite uses dlopen necessitating cleanup in source directories
+COMPONENT_PRE_TEST_ACTION=     find $(COMPONENT_SRC) -name '*.so' -exec rm {} \;

 # common targets
 build:         $(BUILD_32_and_64)

Actions #5

Updated by Alexander Pyhalov almost 6 years ago

I see the following failures with updated pylxml on gmake test :

1715/1715 (100.0%): Doctest: xpathxslt.txt                                                                                                                        
======================================================================
ERROR: test_etree_parse_io_error (lxml.tests.test_io.ETreeIOTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.6/unittest.py", line 279, in run
    testMethod()
  File "/export/home/alp/srcs/oi-userland/components/python/pylxml/lxml-3.5.0/src/lxml/tests/test_io.py", line 276, in test_etree_parse_io_error
    dn = tempfile.mkdtemp(prefix=dirnameRU)
  File "/usr/lib/python2.6/tempfile.py", line 318, in mkdtemp
    _os.mkdir(file, 0700)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-18: ordinal not in range(128)

======================================================================
ERROR: test_etree_parse_io_error (lxml.tests.test_io.ElementTreeIOTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.6/unittest.py", line 279, in run
    testMethod()
  File "/export/home/alp/srcs/oi-userland/components/python/pylxml/lxml-3.5.0/src/lxml/tests/test_io.py", line 276, in test_etree_parse_io_error
    dn = tempfile.mkdtemp(prefix=dirnameRU)
  File "/usr/lib/python2.6/tempfile.py", line 318, in mkdtemp
    _os.mkdir(file, 0700)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-18: ordinal not in range(128)

----------------------------------------------------------------------
Ran 1715 tests in 16.715s

Actions #6

Updated by Richard PALO almost 6 years ago

Alexander Pyhalov wrote:

I see the following failures with updated pylxml on gmake test :
[...]

Don't worry about that for now: https://bugs.launchpad.net/lxml/+bug/1522052

Actions #7

Updated by Alexander Pyhalov almost 6 years ago

  • Status changed from New to Resolved
COMPONENT_TEST_ENV+=    LC_ALL=en_US.UTF-8

fixes this.
Actions

Also available in: Atom PDF