danwent / Perspectives

Perspectives Firefox Extension
http://perspectives-project.org
66 stars 19 forks source link

Failing build with latest python-lxml (3.5.0) module #166

Closed DavidPrevot closed 8 years ago

DavidPrevot commented 8 years ago

Hi,

Building Perspective currently fails:

$ make
rm -f Perspectives.xpi
rm -rf build/
python test/extlib/checkloc.py plugin
(Main) Starting Localization tests...
Traceback (most recent call last):
  File "test/extlib/checkloc.py", line 730, in <module>
    errors = validate_loc_files(args.manifest_dir, locales_only=locales_only)
  File "test/extlib/checkloc.py", line 601, in validate_loc_files
    ms.validate_manifests()
  File "test/extlib/checkloc.py", line 480, in validate_manifests
    for locale in root.findall('.//em:locale', root.nsmap):
  File "src/lxml/lxml.etree.pyx", line 1563, in lxml.etree._Element.findall (src/lxml/lxml.etree.c:61450)
  File "/usr/lib/python2.7/dist-packages/lxml/_elementpath.py", line 304, in findall
    return list(iterfind(elem, path, namespaces))
  File "/usr/lib/python2.7/dist-packages/lxml/_elementpath.py", line 277, in iterfind
    selector = _build_path_iterator(path, namespaces)
  File "/usr/lib/python2.7/dist-packages/lxml/_elementpath.py", line 234, in _build_path_iterator
    raise ValueError("empty namespace prefix is not supported in ElementPath")
ValueError: empty namespace prefix is not supported in ElementPath
Makefile:21: recipe for target 'loctests' failed
make: *** [loctests] Error 1

(issue initially filed in the Debian bug tracking system as https://bugs.debian.org/807673)

daveschaefer commented 8 years ago

Hi David, thanks for the report.

It looks like this is definitely due to changes in lxml 3.5.0 - the changelog mentions "Empty prefixes are explicitly rejected when a namespace mapping is used with ElementPath to avoid hiding bugs in user code"[1] . The code literally now says if .. None in namespaces.

The current checkloc code just uses the mapping built into the xml root; however, this does indeed contain a 'None' entry.

I believe the patch for this is quite simple, but I am unable to reproduce the issue on my current machine. Are you able/willing to test building perspectives using this patch? - https://github.com/daveschaefer/Perspectives/commit/031d27659f5896d518eef20ba30e42761b2605eb

Let me know if there is a better way to get the patch to you.

If that works I can certainly push the patch through. In the meantime I'll work to get access to a real dev environment.

[1] http://lxml.de/3.5/changes-3.5.0.html

DavidPrevot commented 8 years ago

Hi Dave

Le 13/12/2015 03:25, Dave a écrit :

Are you able/willing to test building perspectives using this patch?

I can confirm perspectives builds fine with this patch when lxml 3.5.0 is installed, thanks for your quick fix!

Regards

David

daveschaefer commented 8 years ago

Thanks David!

I was able to properly reproduce both the issue and the fix myself as well. I have pushed the patch through to the checkloc library and can release a new version of Perspectives in the next day or two.

Thanks!

daveschaefer commented 8 years ago

Hey David, sorry for the delay. I just finished up the patch for this and merged it into mainline. I will upload to AMO and release it in a few minutes.

daveschaefer commented 8 years ago

Now uploaded to AMO and available here - https://addons.mozilla.org/firefox/downloads/file/381730/perspectives-4.6.3-sm+fx.xpi - , or as a GitHub release - https://github.com/danwent/Perspectives/releases/tag/v4.6.3 .

Let me know if you have any issues!