summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-06 09:39:26 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-06 09:39:26 +0000
commit0853b8a0c0bc139b2e5156f233e4e1872a42852f (patch)
tree22558f073417e645cfe3839857b238fd845cb25e
parenta6ae4ba0d5534dcaa697e58a76da48da7603b25a (diff)
downloadportage-0853b8a0c0bc139b2e5156f233e4e1872a42852f.tar.gz
portage-0853b8a0c0bc139b2e5156f233e4e1872a42852f.tar.bz2
portage-0853b8a0c0bc139b2e5156f233e4e1872a42852f.zip
Simplify and fix bugs in is_valid_package_atom().
svn path=/main/trunk/; revision=8445
-rw-r--r--pym/_emerge/__init__.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 4733f43f0..e1063dc33 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -4983,17 +4983,11 @@ def checkUpdatedNewsItems(portdb, vardb, NEWS_PATH, UNREAD_PATH, repo_id):
return manager.getUnreadItems( repo_id, update=True )
def is_valid_package_atom(x):
- try:
- testkey = portage.dep_getkey(x)
- except portage.exception.InvalidData:
- return False
- if testkey.startswith("null/"):
- testatom = x.replace(testkey[5:], "cat/"+testkey[5:])
- elif "/" not in x:
- testatom = "cat/"+x
- else:
- testatom = x
- return portage.isvalidatom(testatom)
+ if "/" not in x:
+ alphanum = re.search(r'\w', x)
+ if alphanum:
+ x = x[:alphanum.start()] + "cat/" + x[alphanum.start():]
+ return portage.isvalidatom(x)
def show_blocker_docs_link():
print