force = opts.force
import portage.util, portage.const
-import portage.dep
-portage.dep._dep_check_strict = True
# do this _after_ 'import portage' to prevent unnecessary tracing
if debug and "python-trace" in portage.features:
from _emerge.userquery import userquery
import portage.checksum
import portage.const
-import portage.dep
-portage.dep._dep_check_strict = True
from portage import cvstree, normalize_path
from portage import util
from portage.exception import FileNotFound, ParseError, PermissionDenied
# Use aux_get() to trigger FakeVartree global
# updates on *DEPEND when appropriate.
depstr = " ".join(vardb.aux_get(inst_pkg.cpv, dep_keys))
- try:
- portage.dep._dep_check_strict = False
- success, atoms = portage.dep_check(depstr,
- vardb, settings, myuse=inst_pkg.use.enabled,
- trees=dep_check_trees, myroot=inst_pkg.root)
- finally:
- portage.dep._dep_check_strict = True
+ success, atoms = portage.dep_check(depstr,
+ vardb, settings, myuse=inst_pkg.use.enabled,
+ trees=dep_check_trees, myroot=inst_pkg.root)
if not success:
pkg_location = os.path.join(inst_pkg.root,
portage.VDB_PATH, inst_pkg.category, inst_pkg.pf)
# Check for blockers in the other direction.
depstr = " ".join(new_pkg.metadata[k] for k in dep_keys)
- try:
- portage.dep._dep_check_strict = False
- success, atoms = portage.dep_check(depstr,
- vardb, settings, myuse=new_pkg.use.enabled,
- trees=dep_check_trees, myroot=new_pkg.root)
- finally:
- portage.dep._dep_check_strict = True
+ success, atoms = portage.dep_check(depstr,
+ vardb, settings, myuse=new_pkg.use.enabled,
+ trees=dep_check_trees, myroot=new_pkg.root)
if not success:
# We should never get this far with invalid deps.
show_invalid_depstring_notice(new_pkg, depstr, atoms)
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
depstr = node.metadata[dep_type]
if not depstr:
continue
- try:
- portage.dep._dep_check_strict = False
- success, atoms = portage.dep_check(depstr, None, settings,
- myuse=node_use,
- trees=resolver._dynamic_config._graph_trees,
- myroot=myroot)
- finally:
- portage.dep._dep_check_strict = True
+ success, atoms = portage.dep_check(depstr, None, settings,
+ myuse=node_use,
+ trees=resolver._dynamic_config._graph_trees,
+ myroot=myroot)
if not success:
# Ignore invalid deps of packages that will
# be uninstalled anyway.
debug = "--debug" in self._frozen_config.myopts
strict = mytype != "installed"
try:
- if not strict:
- portage.dep._dep_check_strict = False
-
for dep_root, dep_string, dep_priority, ignore_blockers in deps:
if not dep_string:
continue
portage.writemsg("!!! Please notify the package maintainer " + \
"that atoms must be fully-qualified.\n", noiselevel=-1)
return 0
- finally:
- portage.dep._dep_check_strict = True
self._dynamic_config._traversed_pkg_deps.add(pkg)
return 1
trees[root]["atom_graph"] = atom_graph
if priority is not None:
trees[root]["priority"] = priority
- if not strict:
- portage.dep._dep_check_strict = False
mycheck = portage.dep_check(depstring, None,
pkgsettings, myuse=myuse,
myroot=root, trees=trees)
trees[root].pop("atom_graph")
if priority is not None:
trees[root].pop("priority")
- portage.dep._dep_check_strict = True
if not mycheck[0]:
raise portage.exception.InvalidDependString(mycheck[1])
if parent is None:
# optimize dep_check calls by eliminating atoms via
# dep_wordreduce and dep_eval calls.
try:
- portage.dep._dep_check_strict = False
- try:
- success, atoms = portage.dep_check(depstr,
- final_db, pkgsettings, myuse=self._pkg_use_enabled(pkg),
- trees=self._dynamic_config._graph_trees, myroot=myroot)
- except Exception as e:
- if isinstance(e, SystemExit):
- raise
- # This is helpful, for example, if a ValueError
- # is thrown from cpv_expand due to multiple
- # matches (this can happen if an atom lacks a
- # category).
- show_invalid_depstring_notice(
- pkg, depstr, str(e))
- del e
+ success, atoms = portage.dep_check(depstr,
+ final_db, pkgsettings, myuse=self._pkg_use_enabled(pkg),
+ trees=self._dynamic_config._graph_trees, myroot=myroot)
+ except Exception as e:
+ if isinstance(e, SystemExit):
raise
- finally:
- portage.dep._dep_check_strict = True
+ # This is helpful, for example, if a ValueError
+ # is thrown from cpv_expand due to multiple
+ # matches (this can happen if an atom lacks a
+ # category).
+ show_invalid_depstring_notice(
+ pkg, depstr, str(e))
+ del e
+ raise
if not success:
replacement_pkg = final_db.match_pkgs(pkg.slot_atom)
if replacement_pkg and \
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
bad = create_color_func("BAD")
import portage.elog
-import portage.dep
-portage.dep._dep_check_strict = True
import portage.util
import portage.locks
import portage.exception
try:
x = Atom(x)
except InvalidAtom:
- if portage.dep._dep_check_strict:
- raise ParseError(
- _("invalid atom: '%s'") % x)
- else:
- # Only real Atom instances are allowed past this point.
- continue
+ raise ParseError(
+ _("invalid atom: '%s'") % x)
else:
if x.blocker and x.blocker.overlap.forbid and \
- eapi in ("0", "1") and portage.dep._dep_check_strict:
+ eapi in ("0", "1"):
raise ParseError(
_("invalid atom: '%s'") % (x,))
- if x.use and eapi in ("0", "1") and \
- portage.dep._dep_check_strict:
+ if x.use and eapi in ("0", "1"):
raise ParseError(
_("invalid atom: '%s'") % (x,))
writemsg("mysplit: %s\n" % (mysplit), 1)
writemsg("mysplit2: %s\n" % (mysplit2), 1)
- try:
- selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
- use_binaries=use_binaries, trees=trees)
- except InvalidAtom as e:
- if portage.dep._dep_check_strict:
- raise # This shouldn't happen.
- # dbapi.match() failed due to an invalid atom in
- # the dependencies of an installed package.
- return [0, _("Invalid atom: '%s'") % (e,)]
+ selected_atoms = dep_zapdeps(mysplit, mysplit2, myroot,
+ use_binaries=use_binaries, trees=trees)
return [1, selected_atoms]
from portage.tests import TestCase
from portage.dep import Atom
-import portage.dep
-portage.dep._dep_check_strict = True
+from portage.exception import InvalidAtom
class TestAtom(TestCase):
""" A simple testcase for isvalidatom
msg="Atom('%s').use == '%s'" % ( atom, a.use ) )
for atom, allow_wildcard in tests_xfail:
- self.assertRaisesMsg(atom, portage.exception.InvalidAtom, Atom, atom)
+ self.assertRaisesMsg(atom, InvalidAtom, Atom, atom)
def test_violated_conditionals(self):
test_cases = (
for atom, other_use, parent_use in test_cases_xfail:
a = Atom(atom)
- self.assertRaisesMsg(atom, portage.exception.InvalidAtom, \
+ self.assertRaisesMsg(atom, InvalidAtom, \
a.violated_conditionals, other_use, parent_use)
from portage.tests import TestCase
from portage.dep import isvalidatom
-import portage.dep
-portage.dep._dep_check_strict = True
class IsValidAtom(TestCase):
""" A simple testcase for isvalidatom