From bc5315439918ddbb18b87c780dd61ba1863ae11c Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Fri, 12 Jan 2007 08:08:03 +0000 Subject: more string deprecation svn path=/main/trunk/; revision=5595 --- pym/portage_dep.py | 4 ++-- pym/portage_locks.py | 7 +++---- pym/portage_util.py | 10 +++++----- pym/portage_versions.py | 14 +++++++------- pym/xpak.py | 4 ++-- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/pym/portage_dep.py b/pym/portage_dep.py index cc662d5ca..59fa3a0f5 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -18,7 +18,7 @@ # "a? ( b? ( z ) ) -- Valid # -import re, string, sys, types +import re, sys, types import portage_exception from portage_exception import InvalidData from portage_versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify @@ -180,7 +180,7 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): 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(" --> "+"".join(map(str,[head]+newdeparray))+"\n") # Check that each flag matches ismatch = True diff --git a/pym/portage_locks.py b/pym/portage_locks.py index e2772956f..50ac09178 100644 --- a/pym/portage_locks.py +++ b/pym/portage_locks.py @@ -7,7 +7,6 @@ import errno import os import stat -import string import time import types import portage_exception @@ -264,11 +263,11 @@ def hardlock_cleanup(path, remove_all_locks=False): 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 = parts[1].split("-") + host = "-".join(hostpid[:-1]) pid = hostpid[-1] if not mylist.has_key(filename): diff --git a/pym/portage_util.py b/pym/portage_util.py index 407dcc122..407c7957d 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -47,16 +47,16 @@ def grabfile(myfilename, compat_level=0, recursive=0): 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)) + myline="".join(x.split()) if not len(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. @@ -154,7 +154,7 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0): 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): @@ -205,7 +205,7 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1): #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: diff --git a/pym/portage_versions.py b/pym/portage_versions.py index 6a354e0c2..63d69bac4 100644 --- a/pym/portage_versions.py +++ b/pym/portage_versions.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -import re,string +import re ver_regexp = re.compile("^(cvs\\.)?(\\d+)((\\.\\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\\d*)*)(-r(\\d+))?$") suffix_regexp = re.compile("^(alpha|beta|rc|pre|p)(\\d*)$") @@ -98,8 +98,8 @@ def vercmp(ver1, ver2, silent=1): list2.append(int(vlist2[i])) # now we have to use floats so 1.02 compares correctly against 1.1 else: - list1.append(string.atof("0."+vlist1[i])) - list2.append(string.atof("0."+vlist2[i])) + list1.append(float("0."+vlist1[i])) + list2.append(float("0."+vlist2[i])) # and now the final letter if len(match1.group(5)): @@ -183,8 +183,8 @@ def pkgcmp(pkg1, pkg2): return 1 if mycmp<0: return -1 - r1=string.atof(pkg1[2][1:]) - r2=string.atof(pkg2[2][1:]) + r1=float(pkg1[2][1:]) + r2=float(pkg2[2][1:]) if r1>r2: return 1 if r2>r1: @@ -201,7 +201,7 @@ def pkgsplit(mypkg,silent=1): return pkgcache[mypkg][:] except KeyError: pass - myparts=string.split(mypkg,'-') + myparts=mypkg.split("-") if len(myparts)<2: if not silent: @@ -241,7 +241,7 @@ def pkgsplit(mypkg,silent=1): 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: diff --git a/pym/xpak.py b/pym/xpak.py index dff1ab70e..b7ef582e8 100644 --- a/pym/xpak.py +++ b/pym/xpak.py @@ -16,7 +16,7 @@ # (integer) == encodeint(integer) ===> 4 characters (big-endian copy) # '+' means concatenate the fields ===> All chunks are strings -import sys,os,string,shutil,errno +import sys,os,shutil,errno from stat import * def addtolist(mylist,curdir): @@ -353,7 +353,7 @@ class tbz2: 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'.""" -- cgit v1.2.3-1-g7c22