Many undefined name errors in python-xpyb package

Bug #1231463 reported by Riskable
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
xpyb (Debian)
Fix Released
Unknown
xpyb (Ubuntu)
Confirmed
Undecided
bomkim

Bug Description

The python-xpyb package in Ubuntu is broken. I believe it has to do with the way the package is built because the same package is not broken on other Linux distros (e.g. Arch, Gentoo, etc) and they're not doing any sort of interesting patching as part of their build process (that I could see, anyway). So it's not an upstream problem. The problem is that various references to xproto classes such as "xproto.RECTANGLE" wind up as undefined names in the files. So instead of having, "xproto.RECTANGLE" (which is correct) several xpyb files will just have "RECTANGLE" (which is an undefined name). This results in tracebacks like this:

    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 672, in start
        self._handlers[fd](fd, events)
      File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 331, in wrapped
        raise_exc_info(exc)
      File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 302, in wrapped
        ret = fn(*args, **kwargs)
      File "/opt/gateone/applications/x11/x11.py", line 719, in ioloop_handler
        e = self.conn.poll_for_event()
      File "/usr/lib/python2.7/dist-packages/xcb/damage.py", line 46, in __init__
        self.area = RECTANGLE(parent, offset, 8)
    NameError: global name 'RECTANGLE' is not defined

The fix for that one is easy: Change the use of "RECTANGLE" with "xproto.RECTANGLE". In damage.py it's only two lines. The problem though is that undefined names like that can be found in several other files:

    riskable@enterprise:/usr/lib/python2.7/dist-packages/xcb $ pyflakes *.py | grep "undefined name"
    damage.py:46: undefined name 'RECTANGLE' <-- Needs to be xproto.RECTANGLE
    damage.py:49: undefined name 'RECTANGLE' <-- Needs to be xproto.RECTANGLE
    __init__.py:1: 'from xcb import *' used; unable to detect undefined names <-- Ignore this one =)
    randr.py:284: undefined name 'TRANSFORM' <-- Needs to be render.TRANSFORM
    randr.py:289: undefined name 'TRANSFORM' <-- Needs to be render.TRANSFORM
    render.py:290: undefined name 'STR' <-- Needs to be xproto.STR
    shape.py:66: undefined name 'RECTANGLE' <-- Needs to be xproto.RECTANGLE
    xfixes.py:92: undefined name 'RECTANGLE' <-- Needs to be xproto.RECTANGLE
    xfixes.py:96: undefined name 'RECTANGLE' <-- Needs to be xproto.RECTANGLE
    xvmc.py:83: undefined name 'ImageFormatInfo' <-- Needs to be xv.ImageFormatInfo

I suspect this is caused by the build process which I believe is using SWIG. There's probably a file somewhere that needs to be tweaked to ensure the auto-generated .py files get the proper names for these things.

Unfortunately my knowledge of SWIG and auto-generation of C bindings is near zero. Otherwise I'd fix it myself and provide a patch. I can provide a post-build patch that will correct the files but I believe the best course of action is to simply fix whatever it is in the build process that's causing the breakage... Like I said previously, only Ubuntu seems to have this problem with this particular package.

Thanks for any and all assistance in getting this problem corrected!

Changed in xpyb (Debian):
status: Unknown → New
Revision history for this message
Mitja Kleider (mkleider) wrote :

Just wanted to share what I found out so far:

The package xcb-proto contains XML protocol definitions like damage.xml (upstream doc: http://cgit.freedesktop.org/xcb/proto/tree/doc/xml-xcb.txt ).

Python bindings are generated from these definitions using custom generator modules. The modules are part of another Debian package (python-xcbgen), also built from the source package xcb-proto.

xcbgen is imported by py_client.py in the xpyb source package, which just calls the parsing module for each XML protocol definition.

I think the issue is somewhere in python-xcbgen, but could not look into it further yet.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xpyb (Ubuntu):
status: New → Confirmed
bomkim (oozz1373)
Changed in xpyb (Ubuntu):
assignee: nobody → bomkim (oozz1373)
Changed in xpyb (Debian):
status: New → 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.