aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-05-31 01:26:06 +0300
committerMykyta Holubakha <hilobakho@gmail.com>2017-05-31 01:26:06 +0300
commit7c9330d8f788e9671f7db95cafa0cdca045f0472 (patch)
treeb7cfe7dd23dfb212892a49ad8dbd48ecaf281468 /pomu/repo/repo.py
parentAdded vim swap files to .gitignore (diff)
downloadpomu-7c9330d8f788e9671f7db95cafa0cdca045f0472.tar.gz
pomu-7c9330d8f788e9671f7db95cafa0cdca045f0472.tar.bz2
pomu-7c9330d8f788e9671f7db95cafa0cdca045f0472.zip
Refactoring
added a Result type separated presentation from logic moved utility code into separate modules
Diffstat (limited to 'pomu/repo/repo.py')
-rw-r--r--pomu/repo/repo.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/pomu/repo/repo.py b/pomu/repo/repo.py
new file mode 100644
index 0000000..bfa97fe
--- /dev/null
+++ b/pomu/repo/repo.py
@@ -0,0 +1,20 @@
+"""Subroutines with repositories"""
+from os import path
+
+import portage
+
+rsets = portage.db[portage.root]['vartree'].settings.repositories
+
+def portage_repos():
+ for repo in rsets.prepos_order:
+ yield repo
+
+def portage_repo_path(repo):
+ """Get the path of a given portage repository"""
+ if repo in rsets.prepos_order:
+ return rsets.prepos[repo].location
+ return None
+
+def pomu_status(repo_path):
+ """Check if pomu is enabled for a repository at a given path"""
+ return path.isdir(path.join(repo_path, 'metadata', 'pomu'))