summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/sets/__init__.py16
-rw-r--r--pym/portage/sets/files.py4
2 files changed, 17 insertions, 3 deletions
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index 72e8b2091..e2087d816 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -157,12 +157,22 @@ def make_category_sets(portdbapi, settings, only_visible=True):
# adhoc test code
if __name__ == "__main__":
- import portage, sys
+ import portage, sys, os
+ from portage.sets.dbapi import CategorySet
+ from portage.sets.files import StaticFileSet
l = make_default_sets("/", "/", portage.settings.profiles, portage.settings, portage.db["/"]["vartree"].dbapi, portage.db["/"]["porttree"].dbapi)
l.update(make_extra_static_sets("/"))
- l2 = make_category_sets(portage.db["/"]["porttree"].dbapi, portage.settings)
if len(sys.argv) > 1:
- l = [s for s in l.union(l2) if s.getName() in sys.argv[1:]]
+ for s in sys.argv[1:]:
+ if s.startswith("category_"):
+ c = s[9:]
+ l.add(CategorySet("category_%s" % c, c, portdbapi, only_visible=only_visible))
+ elif os.path.exists(s):
+ l.add(StaticFileSet(os.path.basename(s), s))
+ elif s != "*":
+ print "ERROR: could not create set '%s'" % s
+ if not "*" in sys.argv:
+ l = [s for s in l if s.getName() in sys.argv[1:]]
for x in l:
print x.getName()+":"
print "DESCRIPTION = %s" % x.getMetadata("Description")
diff --git a/pym/portage/sets/files.py b/pym/portage/sets/files.py
index 921d04b8c..9558cc7a3 100644
--- a/pym/portage/sets/files.py
+++ b/pym/portage/sets/files.py
@@ -18,6 +18,7 @@ class StaticFileSet(EditablePackageSet):
metadata = grabfile(self._filename + ".metadata")
key = None
for line in metadata:
+ line = line.strip()
if len(line) == 0 and key != None:
setattr(self, key, " ".join(value))
key = None
@@ -28,6 +29,9 @@ class StaticFileSet(EditablePackageSet):
value.append(line)
else:
pass
+ else:
+ if key != None:
+ setattr(self, key, " ".join(value))
def write(self):
write_atomic(self._filename, "\n".join(self._atoms)+"\n")