aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-04-30 00:32:28 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-04-30 00:32:28 +0530
commitaa900dddfd051452d86c51e48dd6906acd67325e (patch)
treec264b59431ca2cf4742beaacf595a57fe44ecad2 /client
parentfirst commit (diff)
downloadgentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.tar.gz
gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.tar.bz2
gentoostats-aa900dddfd051452d86c51e48dd6906acd67325e.zip
first version of client to read installed packages
Diffstat (limited to 'client')
-rw-r--r--client/__init__.py1
-rwxr-xr-xclient/bin/client11
-rw-r--r--client/dbapi.py4
-rw-r--r--client/packages.py12
4 files changed, 28 insertions, 0 deletions
diff --git a/client/__init__.py b/client/__init__.py
new file mode 100644
index 0000000..3c6cfa2
--- /dev/null
+++ b/client/__init__.py
@@ -0,0 +1 @@
+# Make this a python package
diff --git a/client/bin/client b/client/bin/client
new file mode 100755
index 0000000..bdc16c7
--- /dev/null
+++ b/client/bin/client
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+from packages import Packages
+
+def main ():
+ p = Packages ()
+ for cp in p.getInstalledCPs ():
+ print cp
+
+if __name__ == "__main__":
+ main ()
diff --git a/client/dbapi.py b/client/dbapi.py
new file mode 100644
index 0000000..d5d65fa
--- /dev/null
+++ b/client/dbapi.py
@@ -0,0 +1,4 @@
+import portage
+
+PORTDB = portage.db[portage.root]["porttree"].dbapi
+VARDB = portage.db[portage.root]["vartree"].dbapi
diff --git a/client/packages.py b/client/packages.py
new file mode 100644
index 0000000..5d41061
--- /dev/null
+++ b/client/packages.py
@@ -0,0 +1,12 @@
+
+import logging
+from dbapi import VARDB
+
+class Packages:
+ def getInstalledCPs (self):
+ installed_cps = sorted (VARDB.cp_all ())
+ return installed_cps
+
+ def getInstalledCPVs (self):
+ installed_cpvs = sorted (VARDB.cpv_all ())
+ return installed_cpvs