1 |
commit: 265522ead46dc6c4365aa0237ffb78cf21e7a421 |
2 |
Author: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Apr 30 13:11:26 2011 +0000 |
4 |
Commit: Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com> |
5 |
CommitDate: Sat Apr 30 13:11:26 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoostats.git;a=commit;h=265522ea |
7 |
|
8 |
read portage variables |
9 |
|
10 |
--- |
11 |
TODO | 3 +-- |
12 |
client/bin/client | 7 +++++++ |
13 |
client/environment.py | 19 +++++++++++++++++++ |
14 |
3 files changed, 27 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/TODO b/TODO |
17 |
index 3e45289..e0110d1 100644 |
18 |
--- a/TODO |
19 |
+++ b/TODO |
20 |
@@ -1,2 +1 @@ |
21 |
-* Add use flags to client |
22 |
-* Add env vars to client |
23 |
+* Remove dependency on gentoolkit |
24 |
|
25 |
diff --git a/client/bin/client b/client/bin/client |
26 |
index 0720466..26edcb4 100755 |
27 |
--- a/client/bin/client |
28 |
+++ b/client/bin/client |
29 |
@@ -2,6 +2,7 @@ |
30 |
|
31 |
from packages import Packages |
32 |
from useflags import UseFlags |
33 |
+from environment import Environment |
34 |
|
35 |
def main (): |
36 |
p = Packages () |
37 |
@@ -11,6 +12,12 @@ def main (): |
38 |
for x in u.getUseFlags (cpv): |
39 |
print x, |
40 |
print |
41 |
+ e = Environment () |
42 |
+ print e.getVar ('CFLAGS') |
43 |
+ print e.getVar ('CXXFLAGS') |
44 |
+ print e.getVar ('LDFLAGS') |
45 |
+ print e.getVar ('CHOST') |
46 |
+ print e.getVar ('FEATURES') |
47 |
|
48 |
if __name__ == "__main__": |
49 |
main () |
50 |
|
51 |
diff --git a/client/environment.py b/client/environment.py |
52 |
new file mode 100644 |
53 |
index 0000000..5300bef |
54 |
--- /dev/null |
55 |
+++ b/client/environment.py |
56 |
@@ -0,0 +1,19 @@ |
57 |
+ |
58 |
+import logging |
59 |
+from subprocess import * |
60 |
+ |
61 |
+class Environment: |
62 |
+ |
63 |
+ def __init__ (self): |
64 |
+ try: |
65 |
+ p = Popen (['emerge', '--info'], stdout=PIPE) |
66 |
+ self.out = p.stdout.readlines () |
67 |
+ except OSError, e: |
68 |
+ fatal ('Cannot run emerge --info') |
69 |
+ raise e |
70 |
+ |
71 |
+ def getVar (self, myvar): |
72 |
+ for line in self.out: |
73 |
+ if line.startswith (myvar): |
74 |
+ return line.strip () |
75 |
+ return '' |