From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QG9zW-0006uc-G2 for garchives@archives.gentoo.org; Sat, 30 Apr 2011 13:13:46 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A633D1C008; Sat, 30 Apr 2011 13:13:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 741C01C008 for ; Sat, 30 Apr 2011 13:13:39 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B97BF2AC038 for ; Sat, 30 Apr 2011 13:13:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E926080505 for ; Sat, 30 Apr 2011 13:13:37 +0000 (UTC) From: "Vikraman Choudhury" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Vikraman Choudhury" Message-ID: <265522ead46dc6c4365aa0237ffb78cf21e7a421.vikraman@gentoo> Subject: [gentoo-commits] proj/gentoostats:master commit in: client/bin/, /, client/ X-VCS-Repository: proj/gentoostats X-VCS-Files: TODO client/bin/client client/environment.py X-VCS-Directories: client/bin/ / client/ X-VCS-Committer: vikraman X-VCS-Committer-Name: Vikraman Choudhury X-VCS-Revision: 265522ead46dc6c4365aa0237ffb78cf21e7a421 Date: Sat, 30 Apr 2011 13:13:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: c3ef28f4455455d100ffe4aa42108e2f commit: 265522ead46dc6c4365aa0237ffb78cf21e7a421 Author: Vikraman Choudhury gmail com> AuthorDate: Sat Apr 30 13:11:26 2011 +0000 Commit: Vikraman Choudhury gmail com> CommitDate: Sat Apr 30 13:11:26 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoostats.g= it;a=3Dcommit;h=3D265522ea read portage variables --- TODO | 3 +-- client/bin/client | 7 +++++++ client/environment.py | 19 +++++++++++++++++++ 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 @@ =20 from packages import Packages from useflags import UseFlags +from environment import Environment =20 def main (): p =3D Packages () @@ -11,6 +12,12 @@ def main (): for x in u.getUseFlags (cpv): print x, print + e =3D Environment () + print e.getVar ('CFLAGS') + print e.getVar ('CXXFLAGS') + print e.getVar ('LDFLAGS') + print e.getVar ('CHOST') + print e.getVar ('FEATURES') =20 if __name__ =3D=3D "__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 =3D Popen (['emerge', '--info'], stdout=3DPIPE) + self.out =3D 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 ''