Investigate how would it be to remove the dependency from lxml

Bug #1339445 reported by Michele Simionato
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Engine
Fix Released
High
Michele Simionato

Bug Description

If this could be done, one of the stopping step versus upgrading to Ubuntu 14.04 would be removed. Currently the nrmllib tests fail with
a core dump:

FAIL: test_invalid_schema (openquake.nrmllib.tests.hazard.parsers_test.SourceModelParserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/lxc/engine/rootfs/home/ubuntu/oq-nrmllib/openquake/nrmllib/tests/hazard/parsers_test.py", line 257, in test_invalid_schema
    self.assertRaises(etree.XMLSyntaxError, parser.parse)
AssertionError: XMLSyntaxError not raised

*** Error in `/usr/bin/python': free(): invalid pointer: 0x00000000031192b8 ***
Aborted (core dumped)

We should investigate how big of the problem the lack or NRML schema validation would (i.e. if we could get good error messages anyway it
would not be a problem).

Changed in oq-engine:
milestone: none → 1.0.1
assignee: nobody → Michele Simionato (michele-simionato)
importance: Undecided → Critical
importance: Critical → High
description: updated
description: updated
Revision history for this message
Michele Simionato (michele-simionato) wrote :

ElementTree gives better error messages in some cases.
For instance, given an attribute with a quote which is not escaped

    <nonParametricSeismicSource id="283" name="Kanto Earthquake of "1923 Taisho" type" tectonicRegion="Subduction Interface"></nonParametricSeismicSource>

lxml chokes with

  File "/home/ubuntu/oq-commonlib/openquake/commonlib/source.py", line 131, in parse_source_model
    for src_node in src_nodes:
  File "parser.pxi", line 18, in lxml.etree.ParseError.__init__ (src/lxml/lxml.etree.c:69927)
TypeError: __init__() takes exactly 5 positional arguments (2 given)

whereas ElementTree correctly reports line and column where the offending quote is.

Changed in oq-engine:
milestone: 1.2.0 → 1.3.0
Changed in oq-engine:
milestone: 1.3.0 → 1.4.0
Changed in oq-engine:
milestone: 1.4.0 → 1.5.0
Revision history for this message
Michele Simionato (michele-simionato) wrote :

This is now important again in view of supporting different platforms with a virtualenv. Even on Ubuntu 14.04 it is non obvious to compile lxml from scratch (this is what pip tries to do). Since the only features of lxml we need are trivial to implement in ElementTree (line numbers: 10 lines of code, pretty print: already done in commonlib.writers) I deem lxml useless and ready for removal.

Changed in oq-engine:
status: New → In Progress
Revision history for this message
Michele Simionato (michele-simionato) wrote :
Changed in oq-engine:
status: In Progress → Fix Committed
Changed in oq-engine:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.