summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/__init__.py11
-rw-r--r--pym/portage/sets/__init__.py20
2 files changed, 26 insertions, 5 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 73d143e63..1d324998c 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -13698,15 +13698,22 @@ def expand_set_arguments(myfiles, myaction, root_config):
display_missing_pkg_set(root_config, s)
return (None, 1)
setconfig.active.append(s)
+ try:
+ set_atoms = setconfig.getSetAtoms(s)
+ except portage.exception.PackageSetNotFound, e:
+ writemsg_level(("emerge: the given set '%s' " + \
+ "contains a non-existent set named '%s'.\n") % \
+ (s, e), level=logging.ERROR, noiselevel=-1)
+ return (None, 1)
if myaction in unmerge_actions and \
not sets[s].supportsOperation("unmerge"):
sys.stderr.write("emerge: the given set '%s' does " % s + \
"not support unmerge operations\n")
retval = 1
- elif not setconfig.getSetAtoms(s):
+ elif not set_atoms:
print "emerge: '%s' is an empty set" % s
elif myaction not in do_not_expand:
- newargs.extend(setconfig.getSetAtoms(s))
+ newargs.extend(set_atoms)
else:
newargs.append(SETPREFIX+s)
for e in sets[s].errors:
diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py
index b892bb308..a668c8324 100644
--- a/pym/portage/sets/__init__.py
+++ b/pym/portage/sets/__init__.py
@@ -2,10 +2,14 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+__all__ = ["SETPREFIX", "get_boolean", "SetConfigError",
+ "SetConfig", "load_default_config"]
+
import os
from ConfigParser import SafeConfigParser, NoOptionError
from portage import load_mod
from portage.const import USER_CONFIG_PATH, GLOBAL_CONFIG_PATH
+from portage.exception import PackageSetNotFound
SETPREFIX = "@"
@@ -131,7 +135,13 @@ class SetConfig(object):
return self.psets.copy()
def getSetAtoms(self, setname, ignorelist=None):
- myset = self.getSets()[setname]
+ """
+ This raises PackageSetNotFound if the give setname does not exist.
+ """
+ try:
+ myset = self.getSets()[setname]
+ except KeyError:
+ raise PackageSetNotFound(setname)
myatoms = myset.getAtoms()
parser = self._parser
extend = set()
@@ -150,8 +160,12 @@ class SetConfig(object):
ignorelist.add(setname)
for n in myset.getNonAtoms():
- if n.startswith(SETPREFIX) and n[len(SETPREFIX):] in self.psets:
- extend.add(n[len(SETPREFIX):])
+ if n.startswith(SETPREFIX):
+ s = n[len(SETPREFIX):]
+ if s in self.psets:
+ extend.add(n[len(SETPREFIX):])
+ else:
+ raise PackageSetNotFound(s)
for s in ignorelist:
extend.discard(s)