Gentoo Archives: gentoo-portage-dev

From: solar <solar@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: portage from C (was Re: [gentoo-portage-dev] Hello! && portage UI)
Date: Wed, 15 Mar 2006 21:38:17
Message-Id: 1142458625.10619.131.camel@onyx
In Reply to: portage from C (was Re: [gentoo-portage-dev] Hello! && portage UI) by "Kevin F. Quinn (Gentoo)"
1 On Wed, 2006-03-15 at 21:42 +0100, Kevin F. Quinn (Gentoo) wrote:
2 > On Wed, 15 Mar 2006 09:52:13 -0500
3 > solar <solar@g.o> wrote:
4 >
5 > > On Wed, 2006-03-15 at 10:51 +0100, Paul de Vrieze wrote:
6 > >
7 > > [snip]
8 > >
9 > > > Actually, C++ being strongly related to C, can just use the C
10 > > > python api's. As such it could directly interface with python, and
11 > > > use the python portage api.
12 > >
13 > > If you could demonstrate an 'import portage' and a simple
14 > > printf("PORTDIR=%s\n", PORTDIR); in C I'd be highly interested.
15 >
16 > Try attached :) Had a go 'coz I was curious. Compile with:
17 >
18 > gcc -o getportdir getportdir.c -lpython2.4
19 >
20 > Does the equivalent of:
21 >
22 > #!/usr/bin/portage
23 > import portage;
24 > print portage.settings["PORTDIR"];
25 >
26 > (more or less). Docs on the API itself (which comes with Python) are at
27 > http://docs.python.org/api/api.html
28
29 thanks Kevin,
30 marienz also put 3 examples together to demonstrate it.
31
32 /me feels like a kid in a candy store.
33
34 thanks guys.
35
36
37 --
38 solar <solar@g.o>
39 Gentoo Linux
40
41 --
42 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: portage from C (was Re: [gentoo-portage-dev] Hello! && portage UI) tvali <qtvali@×××××.com>