Re: Linky-style extension in Python



On Wed, 2006-18-10 at 19:31 +0200, Frederic Peters wrote:
> Adam Hooper wrote:
> 
> > > Actually I saw a python-xpcom package in edgy ;-)
> > 
> > Wow! Thanks for letting me know. I'll try to get support into Epiphany
> > within the week :).
> 
> I just remembered this; I would love to get pyxpcom support in
> Epiphany, just ask and I'll do whatever I can (I have lots of Python
> experience, developing bindings and extensions as well as some
> exposure to Epiphany source code).

(cc-ing epiphany-list)

Yeah, I kinda gave up on this. Here's why:

To get that support linked in, we would need to convert our nsISupports
(XPCOM objects) to PyObjects. In PyXPCOM (firefox source:
extensions/python/xpcom/src/PyXPCOM.h) this is possible in
Py_nsISupports::PyObjectFromInterface().

Unfortunately, PyXPCOM.h is a private header, and that method is not
exported anywhere. I've studied that code carefully and I can see why
it's not exported: because it doesn't really line up with PyXPCOM's
goals. However, the main PyXPCOM developer is aware there is a need: see
<http://aspn.activestate.com/ASPN/Mail/Message/pyxpcom/2798406> for a
hint.

That's an awfully old email, so I imagine the restructuring described
there isn't going to happen. I think our best approach would be to build
a helper: just create a VERY simple header file and corresponding source
code, which has one method which internally wraps
PyObjectFromInterface(). I stole the idea from
extensions/python/xpcom/src/loader/pyloader.cpp, since it does the same
thing.

The downside: that's a public .so (or .dll), and a public header, so
there'd be a headache distributing it. I don't imagine the Firefox folks
would think it's a good design.

Of course, it's worth a shot if you have the time. Creating such a patch
would certainly be progress, and I'm guessing it would end up having an
impact (as a Mozilla bug attachment), even if it's not merged into the
Firefox source.

But I don't have the time to do all that :).

(And I could not find a workaround: we *need* PyObjectFromInterface()
and there's *no* path through which we can call it.)

-- 
Adam Hooper
adamh densi com

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]