# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import sys
+
from portage.dep import _repo_separator
+from portage.exception import InvalidData
+
+if sys.hexversion >= 0x3000000:
+ _unicode = str
+else:
+ _unicode = unicode
def create_world_atom(pkg, args_set, root_config):
"""Create a new atom for the world file if one does not exist. If the
for cpv in portdb.match(cp):
for repo in repos:
try:
- available_slots.add(portdb._pkg_str(cpv, repo).slot)
- except KeyError:
+ available_slots.add(portdb._pkg_str(_unicode(cpv), repo).slot)
+ except (KeyError, InvalidData):
pass
slotted = len(available_slots) > 1 or \
for cpv in matches:
for repo in repos:
try:
- matched_slots.add(portdb._pkg_str(cpv, repo).slot)
- except KeyError:
+ matched_slots.add(
+ portdb._pkg_str(_unicode(cpv), repo).slot)
+ except (KeyError, InvalidData):
pass
if len(matched_slots) == 1:
from portage.dep._slot_operator import ignore_built_slot_operator_deps
from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use, \
_get_eapi_attrs
-from portage.exception import (InvalidAtom, InvalidDependString,
+from portage.exception import (InvalidAtom, InvalidData, InvalidDependString,
PackageNotFound, PortageException)
from portage.output import colorize, create_color_func, \
darkgreen, green
other_db._pkg_str(_unicode(cpv), None).slot:
slot_available = True
break
- except KeyError:
+ except (KeyError, InvalidData):
pass
if not slot_available:
continue
from __future__ import print_function
+from portage.exception import InvalidData
from portage.localization import _
from portage._sets.base import PackageSet
from portage._sets import get_boolean, SetConfigError
for cpv in self.dbapi._linkmap.getOwners(p):
try:
pkg = self.dbapi._pkg_str(cpv, None)
- except KeyError:
+ except (KeyError, InvalidData):
# This is expected for preserved libraries
# of packages that have been uninstalled
# without replacement.
try:
slot = self.vartree.dbapi._pkg_str(cpv, None).slot
counter = self.vartree.dbapi.cpv_counter(cpv)
- except KeyError:
+ except (KeyError, InvalidData):
pass
else:
has_vdb_entry = True