From: Sebastian Luther Date: Tue, 10 Aug 2010 19:23:25 +0000 (+0200) Subject: portage.dep._dep_check_strict: Unused, removed X-Git-Tag: v2.2_rc68~329 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e6f50ba776c110a12c47148de5f5799ef8f49479;p=portage.git portage.dep._dep_check_strict: Unused, removed --- diff --git a/bin/ebuild b/bin/ebuild index 08a68f100..617cad355 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -83,8 +83,6 @@ debug = opts.debug 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: diff --git a/bin/repoman b/bin/repoman index fdfd822d7..24065805c 100755 --- a/bin/repoman +++ b/bin/repoman @@ -62,8 +62,6 @@ from _emerge.RootConfig import RootConfig 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 diff --git a/pym/_emerge/BlockerDB.py b/pym/_emerge/BlockerDB.py index 870d80c4f..8b2a22d8e 100644 --- a/pym/_emerge/BlockerDB.py +++ b/pym/_emerge/BlockerDB.py @@ -59,13 +59,9 @@ class BlockerDB(object): # 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) @@ -98,13 +94,9 @@ class BlockerDB(object): # 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) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index aeae5e75d..7acc9e11d 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1,4 +1,4 @@ -# 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 @@ -1088,14 +1088,10 @@ def calc_depclean(settings, trees, ldpath_mtimes, 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. diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 10ad5e491..cf090d422 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1192,9 +1192,6 @@ class depgraph(object): 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 @@ -1250,8 +1247,6 @@ class depgraph(object): 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 @@ -2151,8 +2146,6 @@ class depgraph(object): 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) @@ -2164,7 +2157,6 @@ class depgraph(object): 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: @@ -3291,24 +3283,20 @@ class depgraph(object): # 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 \ diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index aa5891f90..f8a8f22e4 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -1,4 +1,4 @@ -# 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 @@ -25,8 +25,6 @@ good = create_color_func("GOOD") 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 diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index dd6864227..6ca96967f 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -61,19 +61,14 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", 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,)) @@ -569,15 +564,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, 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] diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py index 35f8e5f2e..cd4275eae 100644 --- a/pym/portage/tests/dep/testAtom.py +++ b/pym/portage/tests/dep/testAtom.py @@ -4,8 +4,7 @@ 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 @@ -86,7 +85,7 @@ class TestAtom(TestCase): 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 = ( @@ -135,5 +134,5 @@ class TestAtom(TestCase): 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) diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py index 54a930385..8f8ce3e01 100644 --- a/pym/portage/tests/dep/test_isvalidatom.py +++ b/pym/portage/tests/dep/test_isvalidatom.py @@ -4,8 +4,6 @@ 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