From: Alec Warner Date: Fri, 12 Jan 2007 08:19:46 +0000 (-0000) Subject: More String deprecation X-Git-Tag: v2.1.2~34 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d8bfca254d38cdfe8d193583d2ec7eb590528433;p=portage.git More String deprecation svn path=/main/trunk/; revision=5597 --- diff --git a/bin/archive-conf b/bin/archive-conf index 310687581..bec5b3f0f 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -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 diff --git a/bin/chkcontents b/bin/chkcontents index aae45c6bc..8be51782d 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -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) diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 28c471e94..ca07f8795 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -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']) diff --git a/bin/dohtml b/bin/dohtml index 56347a4a7..054ab36ba 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -30,7 +30,6 @@ # import os -import string import sys import types @@ -95,11 +94,11 @@ def print_help(): print " [-r] [-V] [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": diff --git a/bin/md5check.py b/bin/md5check.py index c83331ede..081495531 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -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)) diff --git a/bin/portageq b/bin/portageq index 5ee16c4ec..0fc195850 100755 --- a/bin/portageq +++ b/bin/portageq @@ -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 [