more string deprecation
authorAlec Warner <antarus@gentoo.org>
Fri, 12 Jan 2007 08:08:03 +0000 (08:08 -0000)
committerAlec Warner <antarus@gentoo.org>
Fri, 12 Jan 2007 08:08:03 +0000 (08:08 -0000)
svn path=/main/trunk/; revision=5595

pym/portage_dep.py
pym/portage_locks.py
pym/portage_util.py
pym/portage_versions.py
pym/xpak.py

index cc662d5ca07d5aaccc2bc0641609412eccbeb193..59fa3a0f51ec184c903e4836fa5e22bda125a6a9 100644 (file)
@@ -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
index e2772956f75ee830441e10b5b2fd5f606457a8cd..50ac09178cf88df3a1b088833fe6cc287e4af588 100644 (file)
@@ -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):
index 407dcc1224f7c311299df6d848578c8eee9d2d3f..407c7957d599d76649b575768b5068950d8aec56 100644 (file)
@@ -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:
index 6a354e0c2665b8fd65af838ae6755edee3af8856..63d69bac4b64abc5247574fc516d5a46338f525f 100644 (file)
@@ -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:
index dff1ab70eaa2553e1a40e4c2e7659c23a1f43652..b7ef582e87c6db56b584f8bca81c9dc007320e5a 100644 (file)
@@ -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'."""