On Wed, 2006-03-15 at 21:42 +0100, Kevin F. Quinn (Gentoo) wrote:
> On Wed, 15 Mar 2006 09:52:13 -0500
> solar <[EMAIL PROTECTED]> wrote:
>
> > On Wed, 2006-03-15 at 10:51 +0100, Paul de Vrieze wrote:
> >
> > [snip]
> >
> > > Actually, C++ being strongly related to C, can just use the C
> > > python api's. As such it could directly interface with python, and
> > > use the python portage api.
> >
> > If you could demonstrate an 'import portage' and a simple
> > printf("PORTDIR=%s\n", PORTDIR); in C I'd be highly interested.
>
> Try attached :) Had a go 'coz I was curious. Compile with:
>
> gcc -o getportdir getportdir.c -lpython2.4
>
> Does the equivalent of:
>
> #!/usr/bin/portage
> import portage;
> print portage.settings["PORTDIR"];
>
> (more or less). Docs on the API itself (which comes with Python) are at
> http://docs.python.org/api/api.html
thanks Kevin,
marienz also put 3 examples together to demonstrate it.
/me feels like a kid in a candy store.
thanks guys.
--
solar <[EMAIL PROTECTED]>
Gentoo Linux
--
[email protected] mailing list