summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/is_valid_package_atom.py
blob: bdfedc95b49620ddb9946898e4e23a876c53b372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import re

try:
	import portage
except ImportError:
	from os import path as osp
	import sys
	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
	import portage

def is_valid_package_atom(x):
	if "/" not in x:
		alphanum = re.search(r'\w', x)
		if alphanum:
			x = x[:alphanum.start()] + "cat/" + x[alphanum.start():]
	return portage.isvalidatom(x)