aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-06-06 02:23:12 +0300
committerMykyta Holubakha <hilobakho@gmail.com>2017-06-06 02:23:12 +0300
commitc2aa4f81e38f0b81ea04648cd77463bd945b7c20 (patch)
tree1f093bb2a8d0b3d2d938066c9bdf424dea86dd3f /pomu/package.py
parentWe can't (diff)
downloadpomu-c2aa4f81e38f0b81ea04648cd77463bd945b7c20.tar.gz
pomu-c2aa4f81e38f0b81ea04648cd77463bd945b7c20.tar.bz2
pomu-c2aa4f81e38f0b81ea04648cd77463bd945b7c20.zip
Add repository and package abstractions
Diffstat (limited to 'pomu/package.py')
-rw-r--r--pomu/package.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pomu/package.py b/pomu/package.py
new file mode 100644
index 0000000..8f0c2c2
--- /dev/null
+++ b/pomu/package.py
@@ -0,0 +1,23 @@
+"""
+A package is a set of files, situated in a root directory.
+A package can be installed into a repository.
+A package is supposed to be created by a package source from a set of files.
+"""
+
+from os import path
+
+from portage.util.string import strip_prefix
+
+class Package():
+ def __init__(self, name, path):
+ self.name = name
+ self.root = path
+ self.read_files(files)
+
+ #todo: file sets
+ def read_files(self)
+ self.files = []
+ for wd, dirs, files in os.walk(path):
+ wd = strip_prefix(strip_prefix(wd, path), '/')
+ self.files.extend([(wd, f) for f in files])
+