diff options
author | Alec Warner <antarus@gentoo.org> | 2007-07-23 07:30:00 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-07-23 07:30:00 +0000 |
commit | dc3b5048d2caa507b4cef8afc345dc4d3ce16e6a (patch) | |
tree | 66ee2777f4392f1e236000f5f914c118f6d0c89c | |
parent | 6751c610e3c59caea7240d097d658ce16fc32392 (diff) | |
download | portage-dc3b5048d2caa507b4cef8afc345dc4d3ce16e6a.tar.gz portage-dc3b5048d2caa507b4cef8afc345dc4d3ce16e6a.tar.bz2 portage-dc3b5048d2caa507b4cef8afc345dc4d3ce16e6a.zip |
Fix imports for style, slight optimization for grab* function, doc fixups.
svn path=/main/trunk/; revision=7369
-rw-r--r-- | pym/portage/util.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pym/portage/util.py b/pym/portage/util.py index de0cb80b7..d10cb1d6a 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -2,12 +2,19 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ + +import os +import errno +import shlex +import stat +import string +import sys + from portage.exception import PortageException, FileNotFound, \ OperationNotPermitted, PermissionDenied, ReadOnlyFileSystem import portage.exception from portage.dep import isvalidatom -import os, errno, shlex, stat, string, sys try: import cPickle except ImportError: @@ -222,6 +229,8 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1): return newdict def grabdict_package(myfilename, juststrings=0, recursive=0): + """ Does the same thing as grabdict except it validates keys + with isvalidatom()""" pkgs=grabdict(myfilename, juststrings, empty=1, recursive=recursive) # We need to call keys() here in order to avoid the possibility of # "RuntimeError: dictionary changed size during iteration" @@ -237,9 +246,7 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0): pkgs=grabfile(myfilename, compatlevel, recursive=recursive) for x in range(len(pkgs)-1, -1, -1): pkg = pkgs[x] - if pkg[0] == "-": - pkg = pkg[1:] - if pkg[0] == "*": # Kill this so we can deal the "packages" file too + if pkg[0] in ["-","*"]: # -atom *pkg for packages file pkg = pkg[1:] if not isvalidatom(pkg): writemsg("--- Invalid atom in %s: %s\n" % (myfilename, pkgs[x]), |