diff options
author | 2011-05-02 20:01:46 +0530 | |
---|---|---|
committer | 2011-05-02 20:01:46 +0530 | |
commit | 5b654c655741caf0c032ad7626f69849b59a2c25 (patch) | |
tree | 6155ec2c26b489b5c2060d1ac73f667331b64d4a /client | |
parent | fixed code style (diff) | |
download | gentoostats-5b654c655741caf0c032ad7626f69849b59a2c25.tar.gz gentoostats-5b654c655741caf0c032ad7626f69849b59a2c25.tar.bz2 gentoostats-5b654c655741caf0c032ad7626f69849b59a2c25.zip |
Use portage.settings instead of forking to emerge --info
Diffstat (limited to 'client')
-rwxr-xr-x | client/bin/client | 7 | ||||
-rw-r--r-- | client/environment.py | 16 |
2 files changed, 5 insertions, 18 deletions
diff --git a/client/bin/client b/client/bin/client index 7d649d1..c41de84 100755 --- a/client/bin/client +++ b/client/bin/client @@ -13,11 +13,8 @@ def main(): 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') + for var in ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CHOST', 'FEATURES'): + print e.getVar(var) if __name__ == "__main__": main() diff --git a/client/environment.py b/client/environment.py index 074c2d1..07b942e 100644 --- a/client/environment.py +++ b/client/environment.py @@ -1,19 +1,9 @@ import logging -import subprocess +import portage class Environment(object): - def __init__(self): - try: - p = subprocess.Popen(['emerge', '--info'], stdout=subprocess.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 '' + ret = portage.settings[myvar] + return ret |