Re: Extending g-ir bindings



On Fri, Sep 23, 2011 at 08:38:30AM +0200, Tomeu Vizoso wrote:
> 2011/9/22 David Nečas <yeti physics muni cz>:
> > Now I'd like my classes to do things such as support the Py_Buffer
> > interface (or other interfaces).  What is the least painful way how to
> > achieve this?
> 
> you can add an override for your typelib such as:
> 
> http://git.gnome.org/browse/pygobject/tree/gi/overrides/Gio.py
> 
> And it can be written in C if you want to do things that cannot be
> done in Python.

Tomeu, thanks for the answer.  Unfortunately, I cannot make it work for
non-system installs.

The value of gi._overridesdir is the system directory, i.e. something
like

    /usr/lib64/python2.7/site-packages/gi/overrides

not writable by a normal user.  And there seems to be no search path
(such as GI_TYPELIB_PATH for the typelibs).

I thought, well, since it is imported using

    overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])

in gi/module.py I can install my overrides elsewhere, e.g. to something
like

    ~/opt/foo/lib/python2.7/site-packages/gi/overrides/

and modify the import path to make it importable.

But of course this does not work.  Python either imports modules from my
new gi directory or the system gi directory.

Did I overlook something?

Yeti



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