diff options
Diffstat (limited to 'pym/portage/env/validators.py')
-rw-r--r-- | pym/portage/env/validators.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pym/portage/env/validators.py b/pym/portage/env/validators.py new file mode 100644 index 000000000..fb29b8d29 --- /dev/null +++ b/pym/portage/env/validators.py @@ -0,0 +1,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 |