summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-07-11 07:08:30 -0700
committerZac Medico <zmedico@gentoo.org>2011-07-11 07:08:30 -0700
commit774ab66e9cc55f749052d690421765647c9c9c9c (patch)
tree64ad8a7f9733498e98c02300cc16f30d68316aee
parent034203acbf22320256aef748d7b0f45e3477e125 (diff)
downloadportage-774ab66e9cc55f749052d690421765647c9c9c9c.tar.gz
portage-774ab66e9cc55f749052d690421765647c9c9c9c.tar.bz2
portage-774ab66e9cc55f749052d690421765647c9c9c9c.zip
is_valid_package_atom: fix circular import
Due to a quirk in python import behavior, this only failed nondeterministically. However, the new preinst sanity test in the portage-9999 ebuild tends to trigger it more often for some people.
-rw-r--r--pym/_emerge/depgraph.py13
-rw-r--r--pym/_emerge/is_valid_package_atom.py18
2 files changed, 15 insertions, 16 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index d0b8fb722..a4b04f698 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -7,7 +7,6 @@ import difflib
import errno
import io
import logging
-import re
import stat
import sys
import textwrap
@@ -49,7 +48,8 @@ from _emerge.DepPriorityNormalRange import DepPriorityNormalRange
from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange
from _emerge.FakeVartree import FakeVartree
from _emerge._find_deep_system_runtime_deps import _find_deep_system_runtime_deps
-from _emerge.is_valid_package_atom import is_valid_package_atom
+from _emerge.is_valid_package_atom import insert_category_into_atom, \
+ is_valid_package_atom
from _emerge.Package import Package
from _emerge.PackageArg import PackageArg
from _emerge.PackageVirtualDbapi import PackageVirtualDbapi
@@ -6690,15 +6690,6 @@ def ambiguous_package_name(arg, atoms, root_config, spinner, myopts):
writemsg("!!! The short ebuild name \"%s\" is ambiguous. Please specify\n" % arg, noiselevel=-1)
writemsg("!!! one of the above fully-qualified ebuild names instead.\n\n", noiselevel=-1)
-def insert_category_into_atom(atom, category):
- alphanum = re.search(r'\w', atom)
- if alphanum:
- ret = atom[:alphanum.start()] + "%s/" % category + \
- atom[alphanum.start():]
- else:
- ret = None
- return ret
-
def _spinner_start(spinner, myopts):
if spinner is None:
return
diff --git a/pym/_emerge/is_valid_package_atom.py b/pym/_emerge/is_valid_package_atom.py
index d33cf4557..7cb2a5bb1 100644
--- a/pym/_emerge/is_valid_package_atom.py
+++ b/pym/_emerge/is_valid_package_atom.py
@@ -1,13 +1,21 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import re
-import portage
-import _emerge.depgraph
+from portage.dep import isvalidatom
+
+def insert_category_into_atom(atom, category):
+ alphanum = re.search(r'\w', atom)
+ if alphanum:
+ ret = atom[:alphanum.start()] + "%s/" % category + \
+ atom[alphanum.start():]
+ else:
+ ret = None
+ return ret
def is_valid_package_atom(x, allow_repo=False):
if "/" not in x:
- x2 = _emerge.depgraph.insert_category_into_atom(x, 'cat')
+ x2 = insert_category_into_atom(x, 'cat')
if x2 != None:
x = x2
- return portage.isvalidatom(x, allow_blockers=False, allow_repo=allow_repo)
+ return isvalidatom(x, allow_blockers=False, allow_repo=allow_repo)