Begin the deprecation of the string module
authorAlec Warner <antarus@gentoo.org>
Fri, 12 Jan 2007 07:58:39 +0000 (07:58 -0000)
committerAlec Warner <antarus@gentoo.org>
Fri, 12 Jan 2007 07:58:39 +0000 (07:58 -0000)
svn path=/main/trunk/; revision=5594

pym/cvstree.py
pym/getbinpkg.py

index 53b9f6222a9da3c2ea5d8188d1867a53cfe99c6f..30f143cd869dc082460d50490ef43eef2c7a0e6c 100644 (file)
@@ -4,7 +4,7 @@
 # $Id$
 
 
-import string,os,time,sys,re
+import os,time,sys,re
 from stat import *
 
 # [D]/Name/Version/Date/Flags/Tags
@@ -12,7 +12,7 @@ from stat import *
 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]
@@ -191,7 +191,7 @@ def getentries(mydir,recursive=0):
                        continue
                if line=="D": # End of entries file
                        break
-               mysplit=string.split(line, "/")
+               mysplit=line.split("/")
                if len(mysplit)!=6:
                        print "Confused:",mysplit
                        continue
index 708897d8feac31e5e64c069864bd887263fb6fa8..7067eefd43f18b0c34a7fe2c20914e8b7d5f5096 100644 (file)
@@ -7,7 +7,7 @@ if not hasattr(__builtins__, "set"):
        from sets import Set as set
 
 from output import *
-import htmllib,HTMLParser,string,formatter,sys,os,xpak,time,tempfile,base64,urllib2
+import htmllib,HTMLParser,formatter,sys,os,xpak,time,tempfile,base64,urllib2
 
 try:
        import cPickle
@@ -78,22 +78,22 @@ def create_conn(baseurl,conn=None):
        """(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:
@@ -111,8 +111,7 @@ def create_conn(baseurl,conn=None):
        if username and password:
                http_headers = {
                        "Authorization": "Basic %s" %
-                         string.replace(
-                           base64.encodestring("%s:%s" % (username, password)),
+                         base64.encodestring("%s:%s" % (username, password)).replace(
                            "\012",
                            ""
                          ),
@@ -211,8 +210,8 @@ def make_http_request(conn, address, params={}, headers={}, dest=None):
                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")
@@ -361,10 +360,10 @@ def file_get(baseurl,dest,conn=None,fcmd=None):
        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)
+       fcmd = fcmd.replace("${DISTDIR}",dest)
+       fcmd = fcmd.replace("${URI}", baseurl)
+       fcmd = fcmd.replace("${FILE}", os.path.basename(baseurl))
+       mysplit = fcmd.split()
        mycmd   = mysplit[0]
        myargs  = [os.path.basename(mycmd)]+mysplit[1:]
        mypid=os.fork()