aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-04-30 18:41:26 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-04-30 18:41:26 +0530
commit265522ead46dc6c4365aa0237ffb78cf21e7a421 (patch)
tree43e86be1e03d007b05f286189e853df9ae987b99
parentadded use flags (diff)
downloadgentoostats-265522ead46dc6c4365aa0237ffb78cf21e7a421.tar.gz
gentoostats-265522ead46dc6c4365aa0237ffb78cf21e7a421.tar.bz2
gentoostats-265522ead46dc6c4365aa0237ffb78cf21e7a421.zip
read portage variables
-rw-r--r--TODO3
-rwxr-xr-xclient/bin/client7
-rw-r--r--client/environment.py19
3 files changed, 27 insertions, 2 deletions
diff --git a/TODO b/TODO
index 3e45289..e0110d1 100644
--- a/TODO
+++ b/TODO
@@ -1,2 +1 @@
-* Add use flags to client
-* Add env vars to client
+* Remove dependency on gentoolkit
diff --git a/client/bin/client b/client/bin/client
index 0720466..26edcb4 100755
--- a/client/bin/client
+++ b/client/bin/client
@@ -2,6 +2,7 @@
from packages import Packages
from useflags import UseFlags
+from environment import Environment
def main ():
p = Packages ()
@@ -11,6 +12,12 @@ def main ():
for x in u.getUseFlags (cpv):
print x,
print
+ e = Environment ()
+ print e.getVar ('CFLAGS')
+ print e.getVar ('CXXFLAGS')
+ print e.getVar ('LDFLAGS')
+ print e.getVar ('CHOST')
+ print e.getVar ('FEATURES')
if __name__ == "__main__":
main ()
diff --git a/client/environment.py b/client/environment.py
new file mode 100644
index 0000000..5300bef
--- /dev/null
+++ b/client/environment.py
@@ -0,0 +1,19 @@
+
+import logging
+from subprocess import *
+
+class Environment:
+
+ def __init__ (self):
+ try:
+ p = Popen (['emerge', '--info'], stdout=PIPE)
+ self.out = p.stdout.readlines ()
+ except OSError, e:
+ fatal ('Cannot run emerge --info')
+ raise e
+
+ def getVar (self, myvar):
+ for line in self.out:
+ if line.startswith (myvar):
+ return line.strip ()
+ return ''