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 |