More String deprecation
authorAlec Warner <antarus@gentoo.org>
Fri, 12 Jan 2007 08:19:46 +0000 (08:19 -0000)
committerAlec Warner <antarus@gentoo.org>
Fri, 12 Jan 2007 08:19:46 +0000 (08:19 -0000)
svn path=/main/trunk/; revision=5597

bin/archive-conf
bin/chkcontents
bin/dispatch-conf
bin/dohtml
bin/md5check.py
bin/portageq
bin/regenworld

index 310687581f2cd4cf7a61d6066c8d3be1b9c0b7a6..bec5b3f0f0e01ffef2bdf82472140506bbd746a6 100755 (executable)
@@ -10,7 +10,7 @@
 #  Jeremy Wohl's dispatch-conf script and the portage chkcontents script.
 #
 
-import os, sys, string
+import os, sys
 try:
     import portage
 except ImportError:
@@ -32,7 +32,7 @@ except ImportError:
         hexform = ""
         for ix in xrange(len(md5sum)):
             hexform = hexform + "%02x" % ord(md5sum[ix])
-        return string.lower(hexform)
+        return hexform.lower()
     
     def perform_checksum(filename):
         f = open(filename, 'rb')
@@ -75,12 +75,12 @@ def archive_conf():
                 sys.exit(1)
             lines = contents.readlines()
             for line in lines:
-                items = string.split(line)
+                items = line.split()
                 if items[0] == 'obj':
                     for conf in args:
                         if items[1] == conf:
-                            stored = string.lower(items[2])
-                            real = string.lower(perform_checksum(conf)[0])
+                            stored = items[2].lower()
+                            real = perform_checksum(conf)[0].lower()
                             if stored == real:
                                 md5_match_hash[conf] = conf
                             todo_cnt -= 1
index aae45c6bcc91a2f46dd3d6aba6e52d74eca8f136..8be51782dc6c4f0539a8a7ad75c87a0233374c9e 100755 (executable)
@@ -8,7 +8,7 @@
 # actual programs on the system (and makes sure that symlinks point to
 # the right files).
 
-import string, os.path, os, sys
+import os.path, os, sys
 try:
        import portage
 except ImportError:
@@ -23,7 +23,7 @@ def CONTENTScheck(path):
                sys.exit(1)
        lines = contents.readlines()
        for line in lines:
-               items = string.split(line)
+               items = line.split()
                # items is a list w/ size depending on the type of item listed in item[0]
                # if items[0] = 'dir' then items[1] is the path of a directory
                # if items[0] = 'obj' then items[1] is the path of a file,
@@ -34,9 +34,9 @@ def CONTENTScheck(path):
                #                          items[3] is the file the symlink should point to
                #                          items[4] is the symlink mtime 
                if (items[0] == 'obj'):
-                       md5stored = string.lower(items[2])
+                       md5stored = items[2].lower()
                        # fchksum.fmdft(file) returns the file's md5sum and the file's size
-                       md5real = string.lower(portage.perform_checksum(items[1])[0])
+                       md5real = portage.perform_checksum(items[1])[0].lower()
                        if (md5stored != md5real):
                                if md5real:
                                        print "%s has md5sum of %s instead of %s" % (items[1], md5real, md5stored)
index 28c471e9455abd1bfa0992b5d8d67e20e882ed7e..ca07f8795d4212ec5135a03f60d290373ac34fc3 100755 (executable)
@@ -17,7 +17,7 @@ if not hasattr(__builtins__, "set"):
 
 from stat import *
 from random import *
-import atexit, commands, os, re, shutil, stat, string, sys
+import atexit, commands, os, re, shutil, stat, sys
 try:
     import portage
 except ImportError:
@@ -362,6 +362,6 @@ d = dispatch ()
 
 if len(sys.argv) > 1:
     # for testing
-    d.grind (string.join (sys.argv [1:]))
+    d.grind ("".join( (sys.argv [1:]))
 else:
     d.grind (portage.settings ['CONFIG_PROTECT'])
index 56347a4a7ac867fd39b2ae7ee9b93438e9aced11..054ab36ba2d64d68cf9625dd29c78dbe7a68159e 100755 (executable)
@@ -30,7 +30,6 @@
 #
 
 import os
-import string
 import sys
 import types
 
@@ -95,11 +94,11 @@ def print_help():
        print "       [-r] [-V] <file> [file ...]"
        print
        print " -a   Set the list of allowed to those that are specified."
-       print "      Default:", string.join(opts.allowed_exts, ",")
+       print "      Default:", ",".join(opts.allowed_exts)
        print " -A   Extend the list of allowed file types."
        print " -f   Set list of allowed extensionless file names."
        print " -x   Set directories to be excluded from recursion."
-       print "      Default:", string.join(opts.disallowed_dirs, ",")
+       print "      Default:", ",".join(opts.disallowed_dirs)
        print " -r   Install files and directories recursively."
        print " -V   Be verbose."
        print
@@ -127,7 +126,7 @@ def parse_args():
                        elif arg == "-p":
                                options.doc_prefix = sys.argv[x]
                        else:
-                               values = string.split(sys.argv[x], ",")
+                               values = sys.argv[x].split(",")
                                if arg == "-A":
                                        options.allowed_exts.extend(values)
                                elif arg == "-a":
index c83331ede426f7350667e08153bb6effa4f57c0d..0814955310537bbd6a95335e67b56dcfeb96d9db 100755 (executable)
@@ -3,7 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-import os,sys,string
+import os,sys
 os.environ["FEATURES"]="mirror cvs"
 try:
        import portage
@@ -33,10 +33,10 @@ for mycp in portage.db["/"]["porttree"].dbapi.cp_all():
 hugelist.sort()
 
 for mycpv in hugelist:
-       pv = string.split(mycpv, "/")[-1]
+       pv = mycpv.split("/")[-1]
 
        newuri = portage.db["/"]["porttree"].dbapi.aux_get(mycpv,["SRC_URI"])[0]
-       newuri = string.split(newuri)
+       newuri = newuri.split()
 
        digestpath = portage.db["/"]["porttree"].dbapi.findname(mycpv)
        digestpath = os.path.dirname(digestpath)+"/files/digest-"+pv
@@ -79,8 +79,8 @@ for mycpv in hugelist:
                                   (md5_list[mybn]["size"] != md5sums[mybn]["size"]):
 
                                        # This associates teh md5 with each file. [md5/size]
-                                       md5joins = string.split(md5_list[mybn][2],",")
-                                       md5joins = string.join(md5joins," ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"],")
+                                       md5joins = md5_list[mybn][2].split(",")
+                                       md5joins = " ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"],".join(md5joins))
                                        md5joins += " ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"]"
 
                                        portage.writemsg("Colliding md5: %s of %s [%s/%s] and %s\n" % (mybn,mycpv,md5sums[mybn][0],md5sums[mybn][1],md5joins))
index 5ee16c4ec802e2d905af655000cac0963406ae1f..0fc19585012f9631652f7b64112bc8f273a3bd41 100755 (executable)
@@ -21,8 +21,7 @@ except KeyboardInterrupt:
 
 import os
 
-import types,string
-
+import types
 
 #-----------------------------------------------------------------------------
 #
@@ -179,7 +178,7 @@ def match(argv):
                print "ERROR: insufficient parameters!"
                sys.exit(2)
        try:
-               print string.join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]),"\n")
+               print "\n".join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]))
        except ValueError, e:
                # Multiple matches thrown from cpv_expand
                pkgs = e.args[0]
@@ -279,7 +278,7 @@ def envvar(argv):
 
 def usage(argv):
        rev="$Revision: 1.13.2.1 $"
-       ver=string.split(rev, ' ')[1]
+       ver= rev.split(' ')[1]
        print ">>> Portage information query tool -- version "+ver
        print ">>> Usage: portageq <command> [<option> ...]"
        print ""
@@ -306,13 +305,13 @@ def usage(argv):
                        print ""
                        continue
 
-               lines = string.split(doc, '\n')
-               print "   "+name+" "+string.strip(lines[0])
+               lines = doc.split("\n")
+               print "   "+name+" "+lines[0].strip()
                if (len(sys.argv) > 1):
                        if ("--help" not in sys.argv):
                                lines = lines[:-1]
                        for line in lines[1:]:
-                               print "      "+string.strip(line)
+                               print "      "+line.strip()
        if (len(sys.argv) == 1):
                print "\nRun portageq with --help for info"
 
index a7428ed9e1d6472e6f5510e53dd1004b8271bb25..0f7de9a2a330b1ce84a93e0634d784a4c89a81bf 100755 (executable)
@@ -9,7 +9,7 @@ try:
 except ImportError:
        sys.path.insert(0, "/usr/lib/portage/pym")
        import portage
-import string, re
+import re
 
 __candidatematcher__ = re.compile("^[0-9]+: \\*\\*\\* emerge ")
 __noncandidatematcher__ = re.compile(" sync( |$)| clean( |$)| search( |$)|--oneshot|--fetchonly| unmerge( |$)")