Attached is a buttload of patches cleaning modules for the following things-
1) types module usage. Use isinstance instead.
2) string module usage. Use string methods instead.
3) stat module usage to get attributes. Stat objects have named
attributes, use them (example would be st[stats.ST_MODE] vs
st.st_mode)
4) range usage. Use xrange instead (former returns a list, latter is
a generator, eg, less mem usage and usually faster)
5) testing for a key, if it doesn't exist, setting a default. Use
setdefault method instead.
6) testing for a key, if it exists, assign that to a var, else assign
a default to the var. use get method instead.
7) ==/!= None tests. use is/is not None instead (faster, ptr
comparison instead of going through the equality protocol).
8) len testing.
if len(blah): # actually is if bool(len(blah)) effectively
use
if blah:
instead- the object knows it's being evaluated being evaluated in a
boolean context, thus avoids intermediate steps.
9) repeated regex compilation. If it's a constant pattern, compile it
once.
10) lack of awareness of iterating over dicts directly, and of
iteritems(). Conversion of for x in d.keys() -> to for x in d:
Latter doesn't create an intermediate list, eg faster/cheaper mem
wise (note to anyone paying attention, only iterate over the dict
directly if you're not mutating the dict within the loop).
Final note, if you're doing 'if x in d.keys()', you need to be
back handed, forcing a linear search for no reason.
11) imports cleanup. If it doesn't use it, no point in importing.
12) General exception cleanup. Know what can be thrown, and catch
that instead of catching everything and requiring SystemExit crap.
13) Set exists, and python 2.3 is already forced. Use it. :)
Related note, portage_util forces sets.Set to be used which is stupid
if set type exists (former is implemented in python, latter is
implemented in cpython, ie, there is a difference in speed).
14) Strings are immutable. They can't be changed, as such attempting to
copy them is stupid (python just returns the string, but still,
don't do it).
15) Bundling your own version of spawn is Plain Idiotic (TM).
16) logic cleanup/simplification.
Modules involved here are mostly straightforward cleanup- changes
should be obvious (sans getbinpkg).
Largest set of changes really is in getbinpkg- code in there is quite
crufty, and a bit dense (IOW, check that chunk over carefully please).
With the potential exception of getbinpkg, these particular patches
are all potential 2.1 material imo; no huge rush on that however
considering that the code already works (these patches just makes the
code suck less).
At the very least, include the portage_util set change; it'll result
in a faster unique_array.
Either way, second set of eyes on the changes would be useful...
~harring
remove .keys() usage (not needed)
whitespace cleanup
stat cleanup
remove attempt to copy a string (strings are immutable)
--- orig-portage-svn/pym/portage_checksum.py 2006-04-06 17:44:02.000000000 -0700
+++ portage-svn/pym/portage_checksum.py 2006-04-08 02:27:56.000000000 -0700
@@ -77,8 +77,8 @@
def perform_all(x, calc_prelink=0):
mydict = {}
- for k in hashfunc_map.keys():
- mydict[k] = perform_checksum(x, hashfunc_map[k], calc_prelink)[0]
+ for chksum_type, func in hashfunc_map.iteritems():
+ mydict[chksum_type] = perform_checksum(x, func, calc_prelink)[0]
return mydict
def get_valid_checksum_keys():
@@ -87,25 +87,29 @@
def verify_all(filename, mydict, calc_prelink=0, strict=0):
# Dict relates to single file only.
# returns: (passed,reason)
+
file_is_ok = True
reason = "Reason unknown"
+
try:
- mysize = os.stat(filename)[stat.ST_SIZE]
+ mysize = os.stat(filename).st_size
if mydict["size"] != mysize:
return False,("Filesize does not match recorded size", mysize, mydict["size"])
except OSError, e:
return False, str(e)
- for x in mydict.keys():
- if x == "size":
+
+ for x in mydict:
+ if x == "size":
continue
- elif x in hashfunc_map.keys():
+ elif x in hashfunc_map:
myhash = perform_checksum(filename, x, calc_prelink=calc_prelink)[0]
if mydict[x] != myhash:
if strict:
- raise portage_exception.DigestException, "Failed to verify '$(file)s' on checksum type '%(type)s'" % {"file":filename, "type":x}
+ raise portage_exception.DigestException(
+ "Failed to verify '$(file)s' on checksum type '%(type)s'" % {"file":filename, "type":x})
else:
file_is_ok = False
- reason = (("Failed on %s verification" % x), myhash,mydict[x])
+ reason = (("Failed on %s verification" % x), myhash,mydict[x])
break
return file_is_ok,reason
@@ -124,7 +128,7 @@
return (sum.hexdigest(), size)
def perform_checksum(filename, hashname="MD5", calc_prelink=0):
- myfilename = filename[:]
+ myfilename = filename
prelink_tmpfile = os.path.join("/", PRIVATE_PATH, "prelink-checksum.tmp." + str(os.getpid()))
mylock = None
string cleanup,
stat cleanup,
use dict methods where applicable
exception cleanup
code simplification (ie, list comps)
--- orig-portage-svn/pym/cvstree.py 2006-04-06 17:44:02.000000000 -0700
+++ portage-svn/pym/cvstree.py 2006-04-09 03:59:14.000000000 -0700
@@ -3,30 +3,22 @@
# Distributed under the terms of the GNU General Public License v2
# $Id: /var/cvsroot/gentoo-src/portage/pym/cvstree.py,v 1.12.2.1 2005/01/16
02:35:33 carpaski Exp $
-
-import string,os,time,sys,re
-from stat import *
+import os,time,sys,re
# [D]/Name/Version/Date/Flags/Tags
def pathdata(entries, path):
"""(entries,path)
Returns the data(dict) for a specific file/dir at the path specified."""
- mysplit=string.split(path,"/")
+ mysplit=path.split("/")
myentries=entries
mytarget=mysplit[-1]
mysplit=mysplit[:-1]
for mys in mysplit:
- if myentries["dirs"].has_key(mys):
- myentries=myentries["dirs"][mys]
- else:
- return None
- if myentries["dirs"].has_key(mytarget):
+ return myentries["dirs"].get(mys, None)
+ if mytarget in myentries["dirs"]:
return myentries["dirs"][mytarget]
- elif myentries["files"].has_key(mytarget):
- return myentries["files"][mytarget]
- else:
- return None
+ return myentries["files"].get(mytarget, None)
def fileat(entries, path):
return pathdata(entries,path)
@@ -64,13 +56,13 @@
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
- if "cvs" in entries["files"][myfile]["status"]:
- if "0" == entries["files"][myfile]["revision"]:
- mylist.append(basedir+myfile)
+ for myfile, data in entries["files"].iteritems():
+ if "cvs" in data["status"] and "0" == data["revision"]:
+ mylist.append(basedir + myfile)
+
if recursive:
- for mydir in entries["dirs"].keys():
-
mylist+=findnew(entries["dirs"][mydir],recursive,basedir+mydir)
+ for mydir, data in entries["dirs"].iteritems():
+ mylist+=findnew(data, recursive, basedir+mydir)
return mylist
def findchanged(entries,recursive=0,basedir=""):
@@ -81,15 +73,14 @@
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
- if "cvs" in entries["files"][myfile]["status"]:
- if "current" not in entries["files"][myfile]["status"]:
- if "exists" in
entries["files"][myfile]["status"]:
- if
entries["files"][myfile]["revision"]!="0":
- mylist.append(basedir+myfile)
+ for myfile, data in entries["files"].iteritems():
+ status = data["status"]
+ if "cvs" in status and "current" not in status and \
+ "exists" in status and bool(data["revision"]):
+ mylist.append(basedir + myfile)
if recursive:
- for mydir in entries["dirs"].keys():
-
mylist+=findchanged(entries["dirs"][mydir],recursive,basedir+mydir)
+ for mydir, data in entries["dirs"].iteritems():
+ mylist+=findchanged(data, recursive, basedir+mydir)
return mylist
def findmissing(entries,recursive=0,basedir=""):
@@ -100,14 +91,13 @@
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
- if "cvs" in entries["files"][myfile]["status"]:
- if "exists" not in entries["files"][myfile]["status"]:
- if "removed" not in
entries["files"][myfile]["status"]:
- mylist.append(basedir+myfile)
+ for myfile, data in entries["files"].iteritems():
+ status = data["status"]
+ if "cvs" in status and not ("exists" in status or "removed" in
status):
+ mylist.append(basedir + myfile)
if recursive:
- for mydir in entries["dirs"].keys():
-
mylist+=findmissing(entries["dirs"][mydir],recursive,basedir+mydir)
+ for mydir, data in entries["dirs"].iteritems():
+ mylist+=findmissing(data, recursive, basedir + mydir)
return mylist
def findunadded(entries,recursive=0,basedir=""):
@@ -120,12 +110,12 @@
mylist=[]
#ignore what cvs ignores.
- for myfile in entries["files"].keys():
- if "cvs" not in entries["files"][myfile]["status"]:
+ for myfile, data in entries["files"].iteritemss():
+ if "cvs" not in data["status"]:
mylist.append(basedir+myfile)
if recursive:
- for mydir in entries["dirs"].keys():
-
mylist+=findunadded(entries["dirs"][mydir],recursive,basedir+mydir)
+ for mydir, data in entries["dirs"].iteritems():
+ mylist+=findunadded(data, recursive, basedir + mydir)
return mylist
def findremoved(entries,recursive=0,basedir=""):
@@ -135,12 +125,12 @@
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
- if "removed" in entries["files"][myfile]["status"]:
- mylist.append(basedir+myfile)
+ for myfile, data in entries["files"].iteritems():
+ if "removed" in data["status"]:
+ mylist.append(basedir + myfile)
if recursive:
- for mydir in entries["dirs"].keys():
-
mylist+=findremoved(entries["dirs"][mydir],recursive,basedir+mydir)
+ for mydir, data in entries["dirs"].iteritems():
+ mylist+=findremoved(data, recursive, basedir + mydir)
return mylist
def findall(entries, recursive=0, basedir=""):
@@ -158,14 +148,8 @@
return [mynew, mychanged, mymissing, myunadded, myremoved]
ignore_list =
re.compile("(^|/)(RCS(|LOG)|SCCS|CVS(|\.adm)|cvslog\..*|tags|TAGS|\.(make\.state|nse_depinfo)|.*~|(\.|)#.*|,.*|_$.*|.*\$|\.del-.*|.*\.(old|BAK|bak|orig|rej|a|olb|o|obj|so|exe|Z|elc|ln)|core)$")
-def apply_cvsignore_filter(list):
- x=0
- while x < len(list):
- if ignore_list.match(list[x].split("/")[-1]):
- list.pop(x)
- else:
- x+=1
- return list
+def apply_cvsignore_filter(filelist):
+ return [x for x in filelist if not ignore_list.match(x.split("/")[-1])]
def getentries(mydir,recursive=0):
"""(basedir,recursive=0)
@@ -185,13 +169,12 @@
except:
mylines=[]
for line in mylines:
- if line and line[-1]=="\n":
- line=line[:-1]
+ lien = line.rstrip("\n")
if not line:
continue
if line=="D": # End of entries file
break
- mysplit=string.split(line, "/")
+ mysplit=line.split("/")
if len(mysplit)!=6:
print "Confused:",mysplit
continue
@@ -210,12 +193,10 @@
entries["dirs"][mysplit[1]]["files"]=rentries["files"]
else:
# [D]/Name/revision/Date/Flags/Tags
- entries["files"][mysplit[1]]={}
- entries["files"][mysplit[1]]["revision"]=mysplit[2]
- entries["files"][mysplit[1]]["date"]=mysplit[3]
- entries["files"][mysplit[1]]["flags"]=mysplit[4]
- entries["files"][mysplit[1]]["tags"]=mysplit[5]
- entries["files"][mysplit[1]]["status"]=["cvs"]
+ entries["files"][mysplit[1]] = \
+ dict(zip(("revision", "date", "flags", "tags",
"cvs"),
+ mysplit[2:6] + [["cvs"]]))
+
if entries["files"][mysplit[1]]["revision"][0]=="-":
entries["files"][mysplit[1]]["status"]+=["removed"]
@@ -225,9 +206,9 @@
if file=="digest-framerd-2.4.3":
print mydir,file
if os.path.isdir(mydir+"/"+file):
- if not entries["dirs"].has_key(file):
+ if not file in entries["dirs"]:
entries["dirs"][file]={"dirs":{},"files":{}}
- if entries["dirs"][file].has_key("status"):
+ if "status" in entries["dirs"][file]:
if "exists" not in
entries["dirs"][file]["status"]:
entries["dirs"][file]["status"]+=["exists"]
else:
@@ -235,9 +216,9 @@
elif os.path.isfile(mydir+"/"+file):
if file=="digest-framerd-2.4.3":
print "isfile"
- if not entries["files"].has_key(file):
+ if file not in entries["files"]:
entries["files"][file]={"revision":"","date":"","flags":"","tags":""}
- if entries["files"][file].has_key("status"):
+ if "status" in entries["files"][file]:
if file=="digest-framerd-2.4.3":
print "has status"
if "exists" not in
entries["files"][file]["status"]:
@@ -251,9 +232,8 @@
try:
if file=="digest-framerd-2.4.3":
print "stat'ing"
- mystat=os.stat(mydir+"/"+file)
-
mytime=time.asctime(time.gmtime(mystat[ST_MTIME]))
- if not entries["files"][file].has_key("status"):
+
mystat=time.asctime(time.gmtime(os.stat(mydir+"/"+file).st_mtime))
+ if not "status" in entries["files"][file]:
if file=="digest-framerd-2.4.3":
print "status not set"
entries["files"][file]["status"]=[]
@@ -265,10 +245,7 @@
if file=="digest-framerd-2.4.3":
print "stat done"
- del mystat
- except SystemExit, e:
- raise
- except Exception, e:
+ except OSError, e:
print "failed to stat",file
print e
return
convert the code over to use get, away from has_key
use 'is None' and bool tests.
don't re-compile regexes unless needed (should speed column output in emerge up a bit)
don't use .keys() unless you're mutating the dict.
--- orig-portage-svn/pym/output.py 2006-04-06 17:44:02.000000000 -0700
+++ portage-svn/pym/output.py 2006-04-08 05:38:41.000000000 -0700
@@ -82,8 +82,10 @@
'0x55FF55', '0xAA5500', '0xFFFF55', '0x0000AA', '0x5555FF', '0xAA00AA',
'0xFF55FF', '0x00AAAA', '0x55FFFF', '0xAAAAAA', '0xFFFFFF']
-for x in xrange(len(rgb_ansi_colors)):
- codes[rgb_ansi_colors[x]] = esc_seq + ansi_color_codes[x]
+# sanity check to make sure nobody screws up above.
+assert len(rgb_ansi_colors) == len(ansi_color_codes)
+for rgb_color, ansi_color in zip(rgb_ansi_colors, ansi_color_codes):
+ codes[rgb_color] = esc_seq + ansi_color
del x
@@ -156,13 +158,13 @@
except PortageException, e:
writemsg("%s\n" % str(e))
+nc_re = re.compile(esc_seq + "^m]+m")
def nc_len(mystr):
- tmp = re.sub(esc_seq + "^m]+m", "", mystr);
- return len(tmp)
+ return len(nc_re.sub("", mystr))
def xtermTitle(mystr):
- if havecolor and dotitles and os.environ.has_key("TERM") and sys.stderr.isatty():
- myt=os.environ["TERM"]
+ myt = os.environ.get("TERM", False)
+ if myt and havecolor and dotitles and sys.stderr.isatty():
legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"]
for term in legal_terms:
if myt.startswith(term):
@@ -181,7 +183,7 @@
else:
pwd = os.getenv('PWD','')
home = os.getenv('HOME', '')
- if home != '' and pwd.startswith(home):
+ if home and pwd.startswith(home):
pwd = '~' + pwd[len(home):]
default_xterm_title = '[EMAIL PROTECTED]:%s' % (
os.getenv('LOGNAME', ''), os.getenv('HOSTNAME', '').split('.', 1)[0], pwd)
@@ -194,7 +196,7 @@
def nocolor():
"turn off colorization"
havecolor=0
- for x in codes.keys():
+ for x in codes:
codes[x]=""
def resetColor():
@@ -209,9 +211,7 @@
def create_color_func(color_key):
def derived_func(*args):
- newargs = list(args)
- newargs.insert(0, color_key)
- return colorize(*newargs)
+ return colorize(*((color_key,) + args))
return derived_func
for c in compat_functions_colors:
remove stat usage (not needed)
convert types usage to isinstance
convert string module usage to methods
.keys() nukage.
re-ordering of hardlink cleansing when removing_all to avoid 2-3 unnecessary
stats.
--- orig-portage-svn/pym/portage_locks.py 2006-04-06 17:44:03.000000000
-0700
+++ portage-svn/pym/portage_locks.py 2006-04-09 04:39:25.000000000 -0700
@@ -6,10 +6,7 @@
import errno
import os
-import stat
-import string
import time
-import types
import portage_exception
import portage_file
import portage_util
@@ -43,14 +40,14 @@
import fcntl
if not mypath:
- raise portage_exception.InvalidData, "Empty path given"
+ raise portage_exception.InvalidData("Empty path given")
- if type(mypath) == types.StringType and mypath[-1] == '/':
+ if isinstance(mypath, basestring) and mypath[-1] == '/':
mypath = mypath[:-1]
- if type(mypath) == types.FileType:
+ elif hasattr(mypath, "fileno"):
mypath = mypath.fileno()
- if type(mypath) == types.IntType:
+ if isinstance(mypath, (long, int)):
lockfilename = mypath
wantnewlockfile = 0
unlinkfile = 0
@@ -60,7 +57,7 @@
else:
lockfilename = mypath
- if type(mypath) == types.StringType:
+ if isinstance(mypath, basestring):
if not os.path.exists(os.path.dirname(mypath)):
raise portage_exception.DirectoryNotFound,
os.path.dirname(mypath)
if not os.path.exists(lockfilename):
@@ -78,7 +75,7 @@
else:
myfd = os.open(lockfilename, os.O_CREAT|os.O_RDWR,0660)
- elif type(mypath) == types.IntType:
+ elif isinstance(mypath, (long, int)):
myfd = mypath
else:
@@ -94,7 +91,7 @@
raise
if e.errno == errno.EAGAIN:
# resource temp unavailable; eg, someone beat us to the
lock.
- if type(mypath) == types.IntType:
+ if isinstance(mypath, (long, int)):
print "waiting for lock on fd %i" % myfd
else:
print "waiting for lock on %s" % lockfilename
@@ -107,7 +104,7 @@
if lockfilename == str(lockfilename):
if wantnewlockfile:
try:
- if
os.stat(lockfilename)[stat.ST_NLINK] == 1:
+ if
os.stat(lockfilename).st_nlink == 1:
os.unlink(lockfilename)
except OSError:
pass
@@ -120,8 +117,8 @@
raise
- if type(lockfilename) == types.StringType and \
- myfd != HARDLINK_FD and os.fstat(myfd).st_nlink != 1:
+ if isinstance(lockfilename, basestring) and myfd != HARDLINK_FD \
+ and os.fstat(myfd).st_nlink != 1:
# The file was deleted on us... Keep trying to make one...
os.close(myfd)
portage_util.writemsg("lockfile recurse\n",1)
@@ -147,7 +144,7 @@
return True
# myfd may be None here due to myfd = mypath in lockfile()
- if type(lockfilename) == types.StringType and not
os.path.exists(lockfilename):
+ if isinstance(lockfilename, basestring) and not
os.path.exists(lockfilename):
portage_util.writemsg("lockfile does not exist '%s'\n" %
lockfilename,1)
if myfd is not None:
os.close(myfd)
@@ -159,7 +156,7 @@
unlinkfile = 1
locking_method(myfd,fcntl.LOCK_UN)
except OSError:
- if type(lockfilename) == types.StringType:
+ if isinstance(lockfilename, basestring):
os.close(myfd)
raise IOError, "Failed to unlock file '%s'\n" % lockfilename
@@ -190,7 +187,7 @@
# why test lockfilename? because we may have been handed an
# fd originally, and the caller might not like having their
# open fd closed automatically on them.
- if type(lockfilename) == types.StringType:
+ if isinstance(lockfilename, basestring):
os.close(myfd)
return True
@@ -211,16 +208,11 @@
myhls = os.stat(link)
mylfs = os.stat(lock)
except OSError:
- myhls = None
- mylfs = None
+ return False
- if myhls:
- if myhls[stat.ST_NLINK] == 2:
- return True
- if mylfs:
- if mylfs[stat.ST_INO] == myhls[stat.ST_INO]:
- return True
- return False
+ if myhls.st_nlink == 2:
+ return True
+ return mylfs.st_ino == myhls.st_ino
def hardlink_lockfile(lockfilename, max_wait=14400):
"""Does the NFS, hardlink shuffle to ensure locking on the disk.
@@ -291,17 +283,14 @@
mylist = {}
for x in mydl:
if os.path.isfile(path+"/"+x):
- parts = string.split(x, ".hardlock-")
+ parts = x.split(".hardlock-")
if len(parts) == 2:
filename = parts[0]
- hostpid = string.split(parts[1],"-")
- host = string.join(hostpid[:-1], "-")
+ hostpid = "-".split(parts[1])
+ host = "-".join(hostpid[:-1])
pid = hostpid[-1]
- if not mylist.has_key(filename):
- mylist[filename] = {}
- if not mylist[filename].has_key(host):
- mylist[filename][host] = []
+ mylist.setdefault(filename,
{}).setdefault(host, [])
mylist[filename][host].append(pid)
mycount += 1
@@ -309,13 +298,12 @@
results.append("Found %(count)s locks" % {"count":mycount})
- for x in mylist.keys():
- if mylist[x].has_key(myhost) or remove_all_locks:
+ for x in mylist:
+ if remove_all_locks or myhost in mylist[x]:
mylockname = hardlock_name(path+"/"+x)
- if hardlink_is_mine(mylockname, path+"/"+x) or \
- not os.path.exists(path+"/"+x) or \
- remove_all_locks:
- for y in mylist[x].keys():
+ if remove_all_locks or hardlink_is_mine(mylockname,
path+"/"+x) \
+ or not os.path.exists(path+"/"+x):
+ for y in mylist[x]:
for z in mylist[x][y]:
filename =
path+"/"+x+".hardlock-"+y+"-"+z
if filename == mylockname:
None cleanup.
Only in portage-svn/pym/cache: __init__.pyc
diff -u orig-portage-svn/pym/cache/anydbm.py portage-svn/pym/cache/anydbm.py
--- orig-portage-svn/pym/cache/anydbm.py 2006-02-24 20:09:00.000000000
-0800
+++ portage-svn/pym/cache/anydbm.py 2006-04-08 19:42:49.000000000 -0700
@@ -67,6 +67,6 @@
return cpv in self.__db
def __del__(self):
- if "__db" in self.__dict__ and self.__db != None:
+ if "__db" in self.__dict__ and self.__db is not None:
self.__db.sync()
self.__db.close()
Only in portage-svn/pym/cache: cache_errors.pyc
Only in portage-svn/pym/cache: flat_hash.pyc
diff -u orig-portage-svn/pym/cache/fs_template.py
portage-svn/pym/cache/fs_template.py
--- orig-portage-svn/pym/cache/fs_template.py 2006-02-24 20:09:00.000000000
-0800
+++ portage-svn/pym/cache/fs_template.py 2006-04-08 19:42:49.000000000
-0700
@@ -44,7 +44,7 @@
return True
def _ensure_dirs(self, path=None):
- """with path!=None, ensure beyond self.location. otherwise,
ensure self.location"""
+ """with path is not None, ensure beyond self.location.
otherwise, ensure self.location"""
if path:
path = os.path.dirname(path)
base = self.location
Only in portage-svn/pym/cache: fs_template.pyc
Files orig-portage-svn/pym/cache/fs_template.pyo and
portage-svn/pym/cache/fs_template.pyo differ
diff -u orig-portage-svn/pym/cache/mappings.py portage-svn/pym/cache/mappings.py
--- orig-portage-svn/pym/cache/mappings.py 2006-02-24 20:09:00.000000000
-0800
+++ portage-svn/pym/cache/mappings.py 2006-04-08 19:42:49.000000000 -0700
@@ -73,7 +73,7 @@
def __getitem__(self, key):
if key in self.d:
return self.d[key]
- elif self.pull != None:
+ elif self.pull is not None:
self.d.update(self.pull())
self.pull = None
return self.d[key]
@@ -83,7 +83,7 @@
return iter(self.keys())
def keys(self):
- if self.pull != None:
+ if self.pull is not None:
self.d.update(self.pull())
self.pull = None
return self.d.keys()
@@ -96,7 +96,7 @@
def __contains__(self, key):
if key in self.d:
return True
- elif self.pull != None:
+ elif self.pull is not None:
self.d.update(self.pull())
self.pull = None
return key in self.d
Only in portage-svn/pym/cache: mappings.pyc
Files orig-portage-svn/pym/cache/mappings.pyo and
portage-svn/pym/cache/mappings.pyo differ
diff -u orig-portage-svn/pym/cache/metadata.py portage-svn/pym/cache/metadata.py
--- orig-portage-svn/pym/cache/metadata.py 2006-03-14 06:09:51.000000000
-0800
+++ portage-svn/pym/cache/metadata.py 2006-04-08 03:00:14.000000000 -0700
@@ -3,7 +3,7 @@
# License: GPL2
# $Id: metadata.py 1964 2005-09-03 00:16:16Z ferringb $
-import os, stat
+import os
import flat_hash
import cache_errors
import eclass_cache
Only in portage-svn/pym/cache: metadata.pyc
Files orig-portage-svn/pym/cache/metadata.pyo and
portage-svn/pym/cache/metadata.pyo differ
diff -u orig-portage-svn/pym/cache/metadata_overlay.py
portage-svn/pym/cache/metadata_overlay.py
--- orig-portage-svn/pym/cache/metadata_overlay.py 2006-03-14
06:09:51.000000000 -0800
+++ portage-svn/pym/cache/metadata_overlay.py 2006-04-08 16:55:18.000000000
-0700
@@ -3,7 +3,7 @@
# $Header: $
import time
-if not hasattr(__builtins__, "set"):
+if "set" not in __builtins__:
from sets import Set as set
import template
from flat_hash import database as db_rw
diff -u orig-portage-svn/pym/cache/sql_template.py
portage-svn/pym/cache/sql_template.py
--- orig-portage-svn/pym/cache/sql_template.py 2006-02-24 20:09:00.000000000
-0800
+++ portage-svn/pym/cache/sql_template.py 2006-04-08 19:42:49.000000000
-0700
@@ -134,7 +134,7 @@
def __del__(self):
# just to be safe.
- if "db" in self.__dict__ and self.db != None:
+ if "db" in self.__dict__ and self.db is not None:
self.commit()
self.db.close()
@@ -234,7 +234,7 @@
l = []
for x, y, v in self.con.fetchall():
if oldcpv != x:
- if oldcpv != None:
+ if oldcpv is not None:
d = dict(l)
if "_eclasses_" in d:
d["_eclasses_"] =
reconstruct_eclasses(oldcpv, d["_eclasses_"])
@@ -242,7 +242,7 @@
l.clear()
oldcpv = x
l.append((y,v))
- if oldcpv != None:
+ if oldcpv is not None:
d = dict(l)
if "_eclasses_" in d:
d["_eclasses_"] = reconstruct_eclasses(oldcpv,
d["_eclasses_"])
Only in portage-svn/pym/cache: template.pyc
Only in portage-svn/pym/cache: util.pyo
set usage for anchor tags
exception cleanup
code simplification (gzip testing, slightly better handling)
string cleanup.
removal of duplicate spawn func
--- orig-portage-svn/pym/getbinpkg.py 2006-04-06 17:44:02.000000000 -0700
+++ portage-svn/pym/getbinpkg.py 2006-04-09 04:08:28.000000000 -0700
@@ -4,8 +4,16 @@
# $Id: /var/cvsroot/gentoo-src/portage/pym/getbinpkg.py,v 1.12.2.3 2005/01/16 02:35:33 carpaski Exp $
+if "set" not in __builtins__:
+ from sets import Set as set
+
from output import *
-import htmllib,HTMLParser,string,formatter,sys,os,xpak,time,tempfile,base64
+import htmllib,HTMLParser,formatter,sys,os,xpak,time,tempfile,base64
+try:
+ import gzip
+ can_do_gzip = True
+except ImportError:
+ can_do_gzip = False
try:
import cPickle
@@ -14,17 +22,17 @@
try:
import ftplib
-except SystemExit, e:
- raise
-except Exception, e:
+except ImportError, e:
sys.stderr.write(red("!!! CANNOT IMPORT FTPLIB: ")+str(e)+"\n")
+ del e
try:
import httplib
-except SystemExit, e:
- raise
-except Exception, e:
+except ImportError, e:
sys.stderr.write(red("!!! CANNOT IMPORT HTTPLIB: ")+str(e)+"\n")
+ del e
+
+from portage_exec import spawn
def make_metadata_dict(data):
myid,myglob = data
@@ -46,19 +54,24 @@
return self.PL_anchors
def get_anchors_by_prefix(self,prefix):
+ # any reason this can't just return a set?
+ known_anchors = set()
newlist = []
for x in self.PL_anchors:
- if (len(x) >= len(prefix)) and (x[:len(suffix)] == prefix):
- if x not in newlist:
- newlist.append(x[:])
+ if x.startswith(prefix) and x not in known_anchors:
+ known_anchors.add(x)
+ newlist.append(x)
+
return newlist
def get_anchors_by_suffix(self,suffix):
+ known_anchors = set()
newlist = []
for x in self.PL_anchors:
- if (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix):
- if x not in newlist:
- newlist.append(x[:])
+ if x.endswith(suffix) and x not in known_anchors:
+ newlist.append(x)
+ known_anchors.add(x)
+
return newlist
def handle_endtag(self,tag):
@@ -76,22 +89,22 @@
"""(baseurl,conn) --- Takes a protocol://site:port/address url, and an
optional connection. If connection is already active, it is passed on.
baseurl is reduced to address and is returned in tuple (conn,address)"""
- parts = string.split(baseurl, "://", 1)
+ parts = baseurl.split("://", 1)
if len(parts) != 2:
raise ValueError, "Provided URL does not contain protocol identifier. '%s'" % baseurl
protocol,url_parts = parts
del parts
- host,address = string.split(url_parts, "/", 1)
+ host,address = url_parts.split("/", 1)
del url_parts
address = "/"+address
- userpass_host = string.split(host, "@", 1)
+ userpass_host = host.split("@", 1)
if len(userpass_host) == 1:
host = userpass_host[0]
userpass = ["anonymous"]
else:
host = userpass_host[1]
- userpass = string.split(userpass_host[0], ":")
+ userpass = userpass_host[0].split(":")
del userpass_host
if len(userpass) > 2:
@@ -107,13 +120,8 @@
http_headers = {}
http_params = {}
if username and password:
- http_headers = {
- "Authorization": "Basic %s" %
- string.replace(
- base64.encodestring("%s:%s" % (username, password)),
- "\012",
- ""
- ),
+ http_headers = {"Authorization":"basic %s" % \
+ base64.encodestring("%s:%s" % (username, password)).replace("\012", "")
}
if not conn:
@@ -150,12 +158,12 @@
conn.voidcmd("TYPE I")
fsize = conn.size(address)
- if (rest != None) and (rest < 0):
+ if (rest is not None) and (rest < 0):
rest = fsize+int(rest)
if rest < 0:
rest = 0
- if rest != None:
+ if rest is not None:
mysocket = conn.transfercmd("RETR "+str(address), rest)
else:
mysocket = conn.transfercmd("RETR "+str(address))
@@ -198,7 +206,7 @@
if (rc != 0):
conn,ignore,ignore,ignore,ignore = create_conn(address)
conn.request("GET", address, params, headers)
- except SystemExit, e:
+ except SystemExit:
raise
except Exception, e:
return None,None,"Server request failed: "+str(e)
@@ -209,8 +217,8 @@
if ((rc == 301) or (rc == 302)):
ignored_data = response.read()
del ignored_data
- for x in string.split(str(response.msg), "\n"):
- parts = string.split(x, ": ", 1)
+ for x in str(response.msg).split("\n"):
+ parts = x.split(": ", 1)
if parts[0] == "Location":
if (rc == 301):
sys.stderr.write(red("Location has moved: ")+str(parts[1])+"\n")
@@ -237,10 +245,10 @@
if not (prefix and suffix):
match_both = 0
-
+
for x in array:
add_p = 0
- if prefix and (len(x) >= len(prefix)) and (x[:len(prefix)] == prefix):
+ if prefix and x.startswith(prefix):
add_p = 1
if match_both:
@@ -248,21 +256,20 @@
continue
else:
if add_p: # Only need one, and we have it.
- myarray.append(x[:])
+ myarray.append(x)
continue
if not allow_overlap: # Not allow to overlap prefix and suffix
- if len(x) >= (len(prefix)+len(suffix)):
+ if len(x) >= len(prefix) + len(suffix):
y = x[len(prefix):]
else:
continue # Too short to match.
else:
y = x # Do whatever... We're overlapping.
- if suffix and (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix):
+ if suffix and x.endswith(suffix):
myarray.append(x) # It matches
- else:
- continue # Doesn't match.
+ # Doesn't match.
return myarray
@@ -359,27 +366,12 @@
if not fcmd:
return file_get_lib(baseurl,dest,conn)
- fcmd = string.replace(fcmd, "${DISTDIR}", dest)
- fcmd = string.replace(fcmd, "${URI}", baseurl)
- fcmd = string.replace(fcmd, "${FILE}", os.path.basename(baseurl))
- mysplit = string.split(fcmd)
- mycmd = mysplit[0]
- myargs = [os.path.basename(mycmd)]+mysplit[1:]
- mypid=os.fork()
- if mypid == 0:
- try:
- os.execv(mycmd,myargs)
- except OSError:
- pass
- sys.stderr.write("!!! Failed to spawn fetcher.\n")
- sys.exit(1)
- retval=os.waitpid(mypid,0)[1]
- if (retval & 0xff) == 0:
- retval = retval >> 8
- else:
- sys.stderr.write("Spawned processes caught a signal.\n")
- sys.exit(1)
- if retval != 0:
+ fcmd = fcmd.replace("${DISTDIR}", dest)
+ fcmd = fcmd.replace("${URI}", baseurl)
+ fcmd = fcmd.replace("${FILE}", os.path.basename(baseurl))
+
+ retval = spawn(fmcd)
+ if retval:
sys.stderr.write("Fetcher exited with a failure condition.\n")
return 0
return 1
@@ -430,20 +422,14 @@
metadata = cPickle.load(metadatafile)
sys.stderr.write("Loaded metadata pickle.\n")
metadatafile.close()
- except SystemExit, e:
- raise
- except:
+ except (IOError, OSError, cPickle.PickleError):
metadata = {}
- if not metadata.has_key(baseurl):
- metadata[baseurl]={}
- if not metadata[baseurl].has_key("indexname"):
- metadata[baseurl]["indexname"]=""
- if not metadata[baseurl].has_key("timestamp"):
- metadata[baseurl]["timestamp"]=0
- if not metadata[baseurl].has_key("unmodified"):
- metadata[baseurl]["unmodified"]=0
- if not metadata[baseurl].has_key("data"):
- metadata[baseurl]["data"]={}
+
+ for k in (baseurl, "data"):
+ metadata.setdefault(k, {})
+ for k in ("timestamp", "unmodified"):
+ metadata.setdefault(k, 0)
+ metadata.setdefault("indexname", "")
filelist = dir_get_list(baseurl, conn)
tbz2list = match_in_array(filelist, suffix=".tbz2")
@@ -455,9 +441,8 @@
metalist.reverse() # makes the order new-to-old.
havecache=0
for mfile in metalist:
- if usingcache and \
- ((metadata[baseurl]["indexname"] != mfile) or \
- (metadata[baseurl]["timestamp"] < int(time.time()-(60*60*24)))):
+ if usingcache and (metadata[baseurl]["indexname"] != mfile or \
+ metadata[baseurl]["timestamp"] < int(time.time() - (60*60*24))):
# Try to download new cache until we succeed on one.
data=""
for trynum in [1,2,3]:
@@ -475,46 +460,45 @@
continue
if match_in_array([mfile],suffix=".gz"):
sys.stderr.write("gzip'd\n")
- try:
- import gzip
- mytempfile.seek(0)
- gzindex = gzip.GzipFile(mfile[:-3],'rb',9,mytempfile)
- data = gzindex.read()
- except SystemExit, e:
- raise
- except Exception, e:
- mytempfile.close()
- sys.stderr.write("!!! Failed to use gzip: "+str(e)+"\n")
+ if can_do_gzip:
+ try:
+ mytempfile.seek(0)
+ gzindex = gzip.GzipFile(mfile[:-3],'rb',9,mytempfile)
+ data = gzindex.read()
+ except (OSError, IOError), e:
+ sys.stderr.write("!!! Failed to use gzip: "+str(e)+"\n")
+ del e
+
mytempfile.close()
+ if not can_do_gzip:
+ # can't use this files metadata.
+ continue
try:
- metadata[baseurl]["data"] = cPickle.loads(data)
- del data
- metadata[baseurl]["indexname"] = mfile
- metadata[baseurl]["timestamp"] = int(time.time())
- metadata[baseurl]["modified"] = 0 # It's not, right after download.
+ # modified isn't right after download.
+ d = {"data":cPickle.loads(data), "indexname":myfile, modified:0}
+ metadata[baseurl].update(d)
+ del data, d
sys.stderr.write("Pickle loaded.\n")
break
- except SystemExit, e:
- raise
- except Exception, e:
+ except cPickle.PickleError, e:
sys.stderr.write("!!! Failed to read data from index: "+str(mfile)+"\n")
sys.stderr.write("!!! "+str(e)+"\n")
+ del e
try:
metadatafile = open("/var/cache/edb/remote_metadata.pickle", "w+")
cPickle.dump(metadata,metadatafile)
metadatafile.close()
- except SystemExit, e:
- raise
- except Exception, e:
+ except (IOError, OSError), e:
sys.stderr.write("!!! Failed to write binary metadata to disk!\n")
sys.stderr.write("!!! "+str(e)+"\n")
+ del e
break
+
# We may have metadata... now we run through the tbz2 list and check.
sys.stderr.write(yellow("cache miss: 'x'")+" --- "+green("cache hit: 'o'")+"\n")
for x in tbz2list:
x = os.path.basename(x)
- if ((not metadata[baseurl]["data"].has_key(x)) or \
- (x not in metadata[baseurl]["data"].keys())):
+ if x not in metadata[baseurl]["data"]:
sys.stderr.write(yellow("x"))
metadata[baseurl]["modified"] = 1
myid = file_get_metadata(baseurl+"/"+x, conn, chunk_size)
@@ -528,7 +512,7 @@
sys.stderr.write("\n")
try:
- if metadata[baseurl].has_key("modified") and metadata[baseurl]["modified"]:
+ if metadata[baseurl].get("modified"):
metadata[baseurl]["timestamp"] = int(time.time())
metadatafile = open("/var/cache/edb/remote_metadata.pickle", "w+")
cPickle.dump(metadata,metadatafile)
@@ -537,11 +521,10 @@
metadatafile = open(makepickle, "w")
cPickle.dump(metadata[baseurl]["data"],metadatafile)
metadatafile.close()
- except SystemExit, e:
- raise
- except Exception, e:
+ except (OSError, cPickle.PickleError), e:
sys.stderr.write("!!! Failed to write binary metadata to disk!\n")
sys.stderr.write("!!! "+str(e)+"\n")
+ del e
if not keepconnection:
conn.close()
string cleanups, and nuking type usage.
--- orig-portage-svn/pym/portage_file.py 2006-04-06 17:44:03.000000000
-0700
+++ portage-svn/pym/portage_file.py 2006-04-08 03:34:51.000000000 -0700
@@ -29,7 +29,7 @@
raise portage_exception.InvalidParameter, _("Invalid
permissions passed. Value is octal and no higher than 02777.")
mypath = normpath(path)
- dirs = string.split(path, "/")
+ dirs = path.split("/")
mypath = ""
if dirs and dirs[0] == "":
--- orig-portage-svn/pym/portage_dep.py 2006-04-06 17:44:02.000000000 -0700
+++ portage-svn/pym/portage_dep.py 2006-04-08 03:34:27.000000000 -0700
@@ -18,7 +18,7 @@
# "a? ( b? ( z ) ) -- Valid
#
-import os,string,types,sys,copy
+import os,sys
import portage_exception
def strip_empty(myarr):
@@ -82,7 +82,7 @@
while mydeparray:
head = mydeparray.pop(0)
- if type(head) == types.ListType:
+ if isinstance(head, list):
additions = use_reduce(head, uselist, masklist,
matchall, excludeall)
if additions:
rlist.append(additions)
@@ -110,7 +110,7 @@
sys.stderr.write("Note: Nested use
flags without parenthesis (Deprecated)\n")
warned = 1
if warned:
- sys.stderr.write(" -->
"+string.join(map(str,[head]+newdeparray))+"\n")
+ sys.stderr.write(" --> %s\n" % "
".join(map(str,[head]+newdeparray)))
# Check that each flag matches
ismatch = True
--- orig-portage-svn/pym/portage_gpg.py 2006-04-06 17:44:03.000000000 -0700
+++ portage-svn/pym/portage_gpg.py 2006-04-08 19:42:49.000000000 -0700
@@ -39,7 +39,7 @@
self.keyringStats = None
self.keyringIsTrusted = False
- if (keydir != None):
+ if (keydir is not None):
# Verify that the keydir is valid.
if type(keydir) != types.StringType:
raise portage_exception.InvalidDataType,
"keydir argument: %s" % keydir
@@ -47,7 +47,7 @@
raise portage_exception.DirectoryNotFound,
"keydir: %s" % keydir
self.keydir = copy.deepcopy(keydir)
- if (keyring != None):
+ if (keyring is not None):
# Verify that the keyring is a valid filename and
exists.
if type(keyring) != types.StringType:
raise portage_exception.InvalidDataType,
"keyring argument: %s" % keyring
string cleanup
bool cleanup
fix sets import so it will use native 2.4 sets if possible
range/xrange
--- orig-portage-svn/pym/portage_util.py 2006-04-06 17:44:06.000000000
-0700
+++ portage-svn/pym/portage_util.py 2006-04-08 16:55:44.000000000 -0700
@@ -10,7 +10,7 @@
except ImportError:
import pickle as cPickle
-if not hasattr(__builtins__, "set"):
+if "set" not in __builtins__:
from sets import Set as set
noiselimit = 0
@@ -37,16 +37,16 @@
for x in mylines:
#the split/join thing removes leading and trailing whitespace,
and converts any whitespace in the line
#into single spaces.
- myline=string.join(string.split(x))
- if not len(myline):
+ myline=" ".join(x.split())
+ if not myline:
continue
if myline[0]=="#":
# Check if we have a compat-level string.
BC-integration data.
# '##COMPAT==>N<==' 'some string attached to it'
- mylinetest = string.split(myline, "<==", 1)
+ mylinetest = myline.split("<==", 1)
if len(mylinetest) == 2:
myline_potential = mylinetest[1]
- mylinetest =
string.split(mylinetest[0],"##COMPAT==>")
+ mylinetest = mylinetest[0].split("##COMPAT==>")
if len(mylinetest) == 2:
if compat_level >= int(mylinetest[1]):
# It's a compat line, and the
key matches.
@@ -116,7 +116,7 @@
final_dict[y] += " "+mydict[y][:]
else:
final_dict[y] = mydict[y][:]
- mydict[y] = string.join(mydict[y].split()) # Remove
extra spaces.
+ mydict[y] = " ".join(mydict[y].split()) # Remove extra
spaces.
return final_dict
def stack_lists(lists, incremental=1):
@@ -143,13 +143,13 @@
#into single spaces.
if x[0] == "#":
continue
- myline=string.split(x)
+ myline=x.split()
if len(myline) < 2 and empty == 0:
continue
if len(myline) < 1 and empty == 1:
continue
if juststrings:
- newdict[myline[0]]=string.join(myline[1:])
+ newdict[myline[0]]=" ".join(myline[1:])
else:
newdict[myline[0]]=myline[1:]
return newdict
@@ -164,7 +164,7 @@
def grabfile_package(myfilename, compatlevel=0, recursive=0):
pkgs=grabfile(myfilename, compatlevel, recursive=recursive)
- for x in range(len(pkgs)-1, -1, -1):
+ for x in xrange(len(pkgs)-1, -1, -1):
pkg = pkgs[x]
if pkg[0] == "-":
pkg = pkg[1:]
@@ -351,7 +351,7 @@
return ""
else:
pos=pos+1
- if len(myvarname)==0:
+ if not myvarname:
cexpand[mystring]=""
return ""
numvars=numvars+1
string import cleanup, nuke stat module usage (access the stat obj directly).
--- orig-portage-svn/pym/xpak.py 2006-04-06 17:44:06.000000000 -0700
+++ portage-svn/pym/xpak.py 2006-04-08 03:43:25.000000000 -0700
@@ -16,8 +16,7 @@
# (integer) == encodeint(integer) ===> 4 characters (big-endian copy)
# '+' means concatenate the fields ===> All chunks are strings
-import sys,os,string,shutil,errno
-from stat import *
+import sys,os,shutil,errno
def addtolist(mylist,curdir):
"""(list, dir) --- Takes an array(list) and appends all files from dir down
@@ -293,9 +292,10 @@
mystat=os.stat(self.file)
if self.filestat:
changed=0
- for x in [ST_SIZE, ST_MTIME, ST_CTIME]:
- if mystat[x] != self.filestat[x]:
+ for x in ("st_size", "st_mtime", "st_ctime"):
+ if getattr(mystat, x) != getattr(self.filestat, x):
changed=1
+ break
if not changed:
return 1
self.filestat=mystat
@@ -353,7 +353,7 @@
mydat=self.getfile(myfile)
if not mydat:
return []
- return string.split(mydat)
+ return mydat.split()
def unpackinfo(self,mydest):
"""Unpacks all the files from the dataSegment into 'mydest'."""
string cleanup, range -> xrange conversion, and removal of caching of failed parsings for pkgver; it
complicates the code a bit, and isn't needed (rarity, when it occurs the neglible overhead is worth avoiding
having to worry about setting None for every bad exit point).
--- orig-portage-svn/pym/portage_versions.py 2006-04-06 17:44:06.000000000 -0700
+++ portage-svn/pym/portage_versions.py 2006-04-09 04:14:44.000000000 -0700
@@ -51,11 +51,11 @@
if len(match1.group(3)) or len(match2.group(3)):
vlist1 = match1.group(3)[1:].split(".")
vlist2 = match2.group(3)[1:].split(".")
- for i in range(0, max(len(vlist1), len(vlist2))):
- if len(vlist1) <= i or len(vlist1[i]) == 0:
+ for i in xrange(0, max(len(vlist1), len(vlist2))):
+ if len(vlist1) <= i or not vlist1[i]:
list1.append(0)
list2.append(string.atoi(vlist2[i]))
- elif len(vlist2) <= i or len(vlist2[i]) == 0:
+ elif len(vlist2) <= i or not vlist2[i]:
list1.append(string.atoi(vlist1[i]))
list2.append(0)
# Let's make life easy and use integers unless we're forced to use floats
@@ -68,12 +68,12 @@
list2.append(string.atof("0."+vlist2[i]))
# and now the final letter
- if len(match1.group(5)):
+ if match1.group(5):
list1.append(ord(match1.group(5)))
- if len(match2.group(5)):
+ if match2.group(5):
list2.append(ord(match2.group(5)))
- for i in range(0, max(len(list1), len(list2))):
+ for i in xrange(0, max(len(list1), len(list2))):
if len(list1) <= i:
vercmp_cache[mykey] = -1
return -1
@@ -88,7 +88,7 @@
list1 = match1.group(6).split("_")[1:]
list2 = match2.group(6).split("_")[1:]
- for i in range(0, max(len(list1), len(list2))):
+ for i in xrange(0, max(len(list1), len(list2))):
if len(list1) <= i:
s1 = ("p","0")
else:
@@ -141,29 +141,25 @@
def pkgsplit(mypkg,silent=1):
try:
- if not pkgcache[mypkg]:
- return None
return pkgcache[mypkg][:]
except KeyError:
pass
- myparts=string.split(mypkg,'-')
+ myparts=mypkg.split('-')
if len(myparts)<2:
if not silent:
print "!!! Name error in",mypkg+": missing a version or name part."
- pkgcache[mypkg]=None
return None
for x in myparts:
- if len(x)==0:
+ if not x:
if not silent:
print "!!! Name error in",mypkg+": empty \"-\" part."
- pkgcache[mypkg]=None
return None
#verify rev
revok=0
myrev=myparts[-1]
- if len(myrev) and myrev[0]=="r":
+ if myrev and myrev[0]=="r":
try:
string.atoi(myrev[1:])
revok=1
@@ -178,7 +174,6 @@
if ververify(myparts[verPos]):
if len(myparts)== (-1*verPos):
- pkgcache[mypkg]=None
return None
else:
for x in myparts[:verPos]:
@@ -186,11 +181,10 @@
pkgcache[mypkg]=None
return None
#names can't have versiony looking parts
- myval=[string.join(myparts[:verPos],"-"),myparts[verPos],revision]
+ myval=["-".join(myparts[:verPos]),myparts[verPos],revision]
pkgcache[mypkg]=myval
return myval
else:
- pkgcache[mypkg]=None
return None
catcache={}
pgpirE9bykDn9.pgp
Description: PGP signature
