Fix some typos.
[portage.git] / pym / _emerge / is_valid_package_atom.py
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 import re
5 from portage.dep import isvalidatom
6
7 def insert_category_into_atom(atom, category):
8         # Handle '*' character for "extended syntax" wildcard support.
9         alphanum = re.search(r'[\*\w]', atom, re.UNICODE)
10         if alphanum:
11                 ret = atom[:alphanum.start()] + "%s/" % category + \
12                         atom[alphanum.start():]
13         else:
14                 ret = None
15         return ret
16
17 def is_valid_package_atom(x, allow_repo=False):
18         if "/" not in x.split(":")[0]:
19                 x2 = insert_category_into_atom(x, 'cat')
20                 if x2 != None:
21                         x = x2
22         return isvalidatom(x, allow_blockers=False, allow_repo=allow_repo)