summaryrefslogtreecommitdiffstats
path: root/pym/portage/env/validators.py
blob: fb29b8d2966601d692ed1e8a181cfc0a7e341532 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# validators.py Portage File Loader Code
# Copyright 2007 Gentoo Foundation
# $Id$

from portage.dep import isvalidatom

ValidAtomValidator = isvalidatom

def PackagesFileValidator(atom):
	""" This function mutates atoms that begin with - or *
	    It then checks to see if that atom is valid, and if
	    so returns True, else it returns False.
	    
	    Args:
		atom: a string representing an atom such as sys-apps/portage-2.1
	"""
	if atom.startswith("*") or atom.startswith("-"):
		atom = atom[1:]
	if not isvalidatom(atom):
		return False
	return True