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:
# 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 = "@"
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()
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)