1 |
So I was the last one :) |
2 |
|
3 |
My example is using python interpreter -- it's maybe simpler to use in |
4 |
many cases, but theoretically slower. |
5 |
|
6 |
It is, anyway, not so advanced to import portage, but you can add that line ;) |
7 |
|
8 |
2006/3/15, solar <solar@g.o>: |
9 |
> On Wed, 2006-03-15 at 21:42 +0100, Kevin F. Quinn (Gentoo) wrote: |
10 |
> > On Wed, 15 Mar 2006 09:52:13 -0500 |
11 |
> > solar <solar@g.o> wrote: |
12 |
> > |
13 |
> > > On Wed, 2006-03-15 at 10:51 +0100, Paul de Vrieze wrote: |
14 |
> > > |
15 |
> > > [snip] |
16 |
> > > |
17 |
> > > > Actually, C++ being strongly related to C, can just use the C |
18 |
> > > > python api's. As such it could directly interface with python, and |
19 |
> > > > use the python portage api. |
20 |
> > > |
21 |
> > > If you could demonstrate an 'import portage' and a simple |
22 |
> > > printf("PORTDIR=%s\n", PORTDIR); in C I'd be highly interested. |
23 |
> > |
24 |
> > Try attached :) Had a go 'coz I was curious. Compile with: |
25 |
> > |
26 |
> > gcc -o getportdir getportdir.c -lpython2.4 |
27 |
> > |
28 |
> > Does the equivalent of: |
29 |
> > |
30 |
> > #!/usr/bin/portage |
31 |
> > import portage; |
32 |
> > print portage.settings["PORTDIR"]; |
33 |
> > |
34 |
> > (more or less). Docs on the API itself (which comes with Python) are at |
35 |
> > http://docs.python.org/api/api.html |
36 |
> |
37 |
> thanks Kevin, |
38 |
> marienz also put 3 examples together to demonstrate it. |
39 |
> |
40 |
> /me feels like a kid in a candy store. |
41 |
> |
42 |
> thanks guys. |
43 |
> |
44 |
> |
45 |
> -- |
46 |
> solar <solar@g.o> |
47 |
> Gentoo Linux |
48 |
> |
49 |
> -- |
50 |
> gentoo-portage-dev@g.o mailing list |
51 |
> |
52 |
> |
53 |
|
54 |
|
55 |
-- |
56 |
tvali |
57 |
(e-mail: "qtvali@×××××.com"; msn: "qtvali@×××××.com"; |
58 |
icq: "317-492-912") |
59 |
|
60 |
Ühe eesti internetifirma lehel kohtasin tsitaati: |
61 |
If you don't do it excellently, dont do it at all. Because if it's not |
62 |
excellent, it won't be profitable or fun, and if you're not in |
63 |
business for fun or profit, what the hell are you doing here? |
64 |
Robert Townsend |