1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 from portage.dep import isvalidatom
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)
11 ret = atom[:alphanum.start()] + "%s/" % category + \
12 atom[alphanum.start():]
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')
22 return isvalidatom(x, allow_blockers=False, allow_repo=allow_repo)