[Python-checkins] python/dist/src/Tools/scripts byteyears.py,1.7,1.8 checkappend.py,1.2,1.3 classfix.py,1.11,1.12 cvsfiles.py,1.4,1.5 dutree.py,1.10,1.11 fixcid.py,1.9,1.10 fixheader.py,1.4,1.5 ftpmirror.py,1.14,1.15 gencodec.py,1.6,1.7 ifdef.py,1.4,1.5 logmerge.py,1.7,1.8 mailerdaemon.py,1.9,1.10 methfix.py,1.6,1.7 nm2def.py,1.4,1.5 objgraph.py,1.5,1.6 pathfix.py,1.4,1.5 pdeps.py,1.5,1.6 pindent.py,1.10,1.11 rgrep.py,1.1,1.2 sum5.py,1.4,1.5 trace.py,1.8,1.9 treesync.py,1.5,1.6 untabify.py,1.2,1.3 which.py,1.9,1.10 xxci.py,1.14,1.15

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Wed, 11 Sep 2002 13:36:04 -0700


Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv827/scripts

Modified Files:
	byteyears.py checkappend.py classfix.py cvsfiles.py dutree.py 
	fixcid.py fixheader.py ftpmirror.py gencodec.py ifdef.py 
	logmerge.py mailerdaemon.py methfix.py nm2def.py objgraph.py 
	pathfix.py pdeps.py pindent.py rgrep.py sum5.py trace.py 
	treesync.py untabify.py which.py xxci.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: byteyears.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/byteyears.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** byteyears.py	17 Jan 2001 08:48:39 -0000	1.7
--- byteyears.py	11 Sep 2002 20:36:01 -0000	1.8
***************
*** 8,12 ****
  
  import sys, os, time
- import string
  from stat import *
  
--- 8,11 ----
***************
*** 52,57 ****
          age = now - anytime
          byteyears = float(size) * float(age) / secs_per_year
!         print string.ljust(file, maxlen),
!         print string.rjust(`int(byteyears)`, 8)
  
  sys.exit(status)
--- 51,56 ----
          age = now - anytime
          byteyears = float(size) * float(age) / secs_per_year
!         print file.ljust(maxlen),
!         print repr(int(byteyears)).rjust(8)
  
  sys.exit(status)

Index: checkappend.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/checkappend.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** checkappend.py	29 Feb 2000 13:08:44 -0000	1.2
--- checkappend.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 36,40 ****
  import os
  import sys
- import string
  import getopt
  import tokenize
--- 36,39 ----
***************
*** 43,47 ****
  
  def errprint(*args):
!     msg = string.join(args)
      sys.stderr.write(msg)
      sys.stderr.write("\n")
--- 42,46 ----
  
  def errprint(*args):
!     msg = ' '.join(args)
      sys.stderr.write(msg)
      sys.stderr.write("\n")

Index: classfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/classfix.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** classfix.py	17 Jan 2001 09:13:33 -0000	1.11
--- classfix.py	11 Sep 2002 20:36:01 -0000	1.12
***************
*** 157,162 ****
  baseprog = regex.compile(baseexpr)
  
- import string
- 
  def fixline(line):
      if classprog.match(line) < 0: # No 'class' keyword -- no change
--- 157,160 ----
***************
*** 177,181 ****
  
      # Extract list of base expressions
!     bases = string.splitfields(basepart, ',')
  
      # Strip trailing '()' from each base expression
--- 175,179 ----
  
      # Extract list of base expressions
!     bases = basepart.split(',')
  
      # Strip trailing '()' from each base expression
***************
*** 186,190 ****
  
      # Join the bases back again and build the new line
!     basepart = string.joinfields(bases, ', ')
  
      return head + '(' + basepart + '):' + tail
--- 184,188 ----
  
      # Join the bases back again and build the new line
!     basepart = ', '.join(bases)
  
      return head + '(' + basepart + '):' + tail

Index: cvsfiles.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/cvsfiles.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** cvsfiles.py	24 Mar 1998 05:30:20 -0000	1.4
--- cvsfiles.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 15,19 ****
  import stat
  import getopt
- import string
  
  cutofftime = 0
--- 15,18 ----
***************
*** 52,56 ****
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = string.split(e, '/')
              if words[0] == '' and words[1:]:
                  name = words[1]
--- 51,55 ----
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = e.split('/')
              if words[0] == '' and words[1:]:
                  name = words[1]

Index: dutree.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/dutree.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dutree.py	17 Jan 2001 09:13:33 -0000	1.10
--- dutree.py	11 Sep 2002 20:36:01 -0000	1.11
***************
*** 2,9 ****
  # Format du output in a tree shape
  
! import os, string, sys, errno
  
  def main():
!     p = os.popen('du ' + string.join(sys.argv[1:]), 'r')
      total, d = None, {}
      for line in p.readlines():
--- 2,9 ----
  # Format du output in a tree shape
  
! import os, sys, errno
  
  def main():
!     p = os.popen('du ' + ' '.join(sys.argv[1:]), 'r')
      total, d = None, {}
      for line in p.readlines():
***************
*** 13,17 ****
          while line[i] in ' \t': i = i+1
          file = line[i:-1]
!         comps = string.splitfields(file, '/')
          if comps[0] == '': comps[0] = '/'
          if comps[len(comps)-1] == '': del comps[len(comps)-1]
--- 13,17 ----
          while line[i] in ' \t': i = i+1
          file = line[i:-1]
!         comps = file.split('/')
          if comps[0] == '': comps[0] = '/'
          if comps[len(comps)-1] == '': del comps[len(comps)-1]
***************
*** 52,56 ****
              psub = prefix
          else:
!             print prefix + string.rjust(`tsub`, width) + ' ' + key
              psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
          if d.has_key(key):
--- 52,56 ----
              psub = prefix
          else:
!             print prefix + repr(tsub).rjust(width) + ' ' + key
              psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
          if d.has_key(key):

Index: fixcid.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixcid.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** fixcid.py	17 Jan 2001 09:13:33 -0000	1.9
--- fixcid.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 37,41 ****
  import sys
  import regex
- import string
  import os
  from stat import *
--- 37,40 ----
***************
*** 214,222 ****
  
  OutsideComment = (Identifier, Number, String, Char, CommentStart)
! OutsideCommentPattern = '\(' + string.joinfields(OutsideComment, '\|') + '\)'
  OutsideCommentProgram = regex.compile(OutsideCommentPattern)
  
  InsideComment = (Identifier, Number, CommentEnd)
! InsideCommentPattern = '\(' + string.joinfields(InsideComment, '\|') + '\)'
  InsideCommentProgram = regex.compile(InsideCommentPattern)
  
--- 213,221 ----
  
  OutsideComment = (Identifier, Number, String, Char, CommentStart)
! OutsideCommentPattern = '\(' + '\|'.join(OutsideComment) + '\)'
  OutsideCommentProgram = regex.compile(OutsideCommentPattern)
  
  InsideComment = (Identifier, Number, CommentEnd)
! InsideCommentPattern = '\(' + '\|'.join(InsideComment) + '\)'
  InsideCommentProgram = regex.compile(InsideCommentPattern)
  
***************
*** 287,294 ****
          lineno = lineno + 1
          try:
!             i = string.index(line, '#')
!         except string.index_error:
              i = -1          # Happens to delete trailing \n
!         words = string.split(line[:i])
          if not words: continue
          if len(words) == 3 and words[0] == 'struct':
--- 286,293 ----
          lineno = lineno + 1
          try:
!             i = line.index('#')
!         except ValueError:
              i = -1          # Happens to delete trailing \n
!         words = line[:i].split()
          if not words: continue
          if len(words) == 3 and words[0] == 'struct':

Index: fixheader.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixheader.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fixheader.py	20 Jul 2001 18:59:21 -0000	1.4
--- fixheader.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 4,8 ****
  
  import sys
- import string
  
  def main():
--- 4,7 ----
***************
*** 30,35 ****
      magic = 'Py_'
      for c in file:
!         if c in string.ascii_letters + string.digits:
!             magic = magic + string.upper(c)
          else: magic = magic + '_'
      sys.stdout = f
--- 29,34 ----
      magic = 'Py_'
      for c in file:
!         if ord(c)<=0x80 and c.isalnum():
!             magic = magic + c.upper()
          else: magic = magic + '_'
      sys.stdout = f

Index: ftpmirror.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ftpmirror.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ftpmirror.py	7 Jun 2001 17:17:00 -0000	1.14
--- ftpmirror.py	11 Sep 2002 20:36:01 -0000	1.15
***************
*** 23,27 ****
  import time
  import getopt
- import string
  import ftplib
  import netrc
--- 23,26 ----
***************
*** 128,132 ****
              # Mac listing has just filenames;
              # trailing / means subdirectory
!             filename = string.strip(line)
              mode = '-'
              if filename[-1:] == '/':
--- 127,131 ----
              # Mac listing has just filenames;
              # trailing / means subdirectory
!             filename = line.strip()
              mode = '-'
              if filename[-1:] == '/':
***************
*** 136,145 ****
          else:
              # Parse, assuming a UNIX listing
!             words = string.split(line, None, 8)
              if len(words) < 6:
                  if verbose > 1: print 'Skipping short line'
                  continue
!             filename = string.lstrip(words[-1])
!             i = string.find(filename, " -> ")
              if i >= 0:
                  # words[0] had better start with 'l'...
--- 135,144 ----
          else:
              # Parse, assuming a UNIX listing
!             words = line.split(None, 8)
              if len(words) < 6:
                  if verbose > 1: print 'Skipping short line'
                  continue
!             filename = words[-1].lstrip()
!             i = filename.find(" -> ")
              if i >= 0:
                  # words[0] had better start with 'l'...
***************
*** 361,365 ****
      prompt = 'Retrieve %s %s from %s ? [ny] ' % (filetype, filename, pwd)
      while 1:
!         reply = string.lower(string.strip(raw_input(prompt)))
          if reply in ['y', 'ye', 'yes']:
              return 1
--- 360,364 ----
      prompt = 'Retrieve %s %s from %s ? [ny] ' % (filetype, filename, pwd)
      while 1:
!         reply = raw_input(prompt).strip().lower()
          if reply in ['y', 'ye', 'yes']:
              return 1

Index: gencodec.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/gencodec.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gencodec.py	16 May 2001 09:41:45 -0000	1.6
--- gencodec.py	11 Sep 2002 20:36:01 -0000	1.7
***************
*** 23,27 ****
  """#"
  
! import string,re,os,time,marshal
  
  # Create numeric tables or character based ones ?
--- 23,27 ----
  """#"
  
! import re,os,time,marshal
  
  # Create numeric tables or character based ones ?
***************
*** 35,41 ****
  
  def parsecodes(codes,
! 
!                split=string.split,atoi=string.atoi,len=len,
!                filter=filter,range=range):
  
      """ Converts code combinations to either a single code integer
--- 35,39 ----
  
  def parsecodes(codes,
!                len=len, filter=filter,range=range):
  
      """ Converts code combinations to either a single code integer
***************
*** 50,59 ****
      if not codes:
          return None
!     l = split(codes,'+')
      if len(l) == 1:
!         return atoi(l[0],16)
      for i in range(len(l)):
          try:
!             l[i] = atoi(l[i],16)
          except ValueError:
              l[i] = None
--- 48,57 ----
      if not codes:
          return None
!     l = codes.split('+')
      if len(l) == 1:
!         return int(l[0],16)
      for i in range(len(l)):
          try:
!             l[i] = int(l[i],16)
          except ValueError:
              l[i] = None
***************
*** 64,70 ****
          return tuple(l)
  
! def readmap(filename,
! 
!             strip=string.strip):
  
      f = open(filename,'r')
--- 62,66 ----
          return tuple(l)
  
! def readmap(filename):
  
      f = open(filename,'r')
***************
*** 77,81 ****
          unmapped[i] = i
      for line in lines:
!         line = strip(line)
          if not line or line[0] == '#':
              continue
--- 73,77 ----
          unmapped[i] = i
      for line in lines:
!         line = line.strip()
          if not line or line[0] == '#':
              continue
***************
*** 109,115 ****
      return enc2uni
  
! def hexrepr(t,
! 
!             join=string.join):
  
      if t is None:
--- 105,109 ----
      return enc2uni
  
! def hexrepr(t):
  
      if t is None:
***************
*** 119,127 ****
      except:
          return '0x%04x' % t
!     return '(' + join(map(lambda t: '0x%04x' % t, t),', ') + ')'
! 
! def unicoderepr(t,
  
!                 join=string.join):
  
      if t is None:
--- 113,119 ----
      except:
          return '0x%04x' % t
!     return '(' + ', '.join(map(lambda t: '0x%04x' % t, t)) + ')'
  
! def unicoderepr(t):
  
      if t is None:
***************
*** 134,142 ****
          except:
              return repr(unichr(t))
!         return repr(join(map(unichr, t),''))
! 
! def keyrepr(t,
  
!             join=string.join):
  
      if t is None:
--- 126,132 ----
          except:
              return repr(unichr(t))
!         return repr(''.join(map(unichr, t)))
  
! def keyrepr(t):
  
      if t is None:
***************
*** 152,156 ****
              else:
                  return repr(unichr(t))
!         return repr(join(map(chr, t),''))
  
  def codegen(name,map,comments=1):
--- 142,146 ----
              else:
                  return repr(unichr(t))
!         return repr(''.join(map(chr, t)))
  
  def codegen(name,map,comments=1):
***************
*** 247,251 ****
  encoding_map = codecs.make_encoding_map(decoding_map)
  ''')
!     return string.join(l,'\n')
  
  def pymap(name,map,pyfile,comments=1):
--- 237,241 ----
  encoding_map = codecs.make_encoding_map(decoding_map)
  ''')
!     return '\n'.join(l)
  
  def pymap(name,map,pyfile,comments=1):
***************
*** 270,276 ****
      for mapname in mapnames:
          name = os.path.split(mapname)[1]
!         name = string.replace(name,'-','_')
!         name = string.split(name, '.')[0]
!         name = string.lower(name)
          codefile = name + '.py'
          marshalfile = name + '.mapping'
--- 260,266 ----
      for mapname in mapnames:
          name = os.path.split(mapname)[1]
!         name = name.replace('-','_')
!         name = name.split('.')[0]
!         name = name.lower()
          codefile = name + '.py'
          marshalfile = name + '.mapping'

Index: ifdef.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ifdef.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ifdef.py	17 Jan 2001 08:48:39 -0000	1.4
--- ifdef.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 30,34 ****
  import regex
  import getopt
- import string
  
  defs = []
--- 30,33 ----
***************
*** 63,72 ****
              if not nextline: break
              line = line + nextline
!         tmp = string.strip(line)
          if tmp[:1] != '#':
              if ok: fpo.write(line)
              continue
!         tmp = string.strip(tmp[1:])
!         words = string.split(tmp)
          keyword = words[0]
          if keyword not in keywords:
--- 62,71 ----
              if not nextline: break
              line = line + nextline
!         tmp = line.strip()
          if tmp[:1] != '#':
              if ok: fpo.write(line)
              continue
!         tmp = tmp[1:].strip()
!         words = tmp.split()
          keyword = words[0]
          if keyword not in keywords:

Index: logmerge.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/logmerge.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** logmerge.py	10 Apr 2001 03:31:27 -0000	1.7
--- logmerge.py	11 Sep 2002 20:36:01 -0000	1.8
***************
*** 25,29 ****
  """
  
! import os, sys, getopt, string, re
  
  sep1 = '='*77 + '\n'                    # file separator
--- 25,29 ----
  """
  
! import os, sys, getopt, re
  
  sep1 = '='*77 + '\n'                    # file separator
***************
*** 85,89 ****
      for line in lines:
          if line[:keylen] == key:
!             working_file = string.strip(line[keylen:])
              break
      else:
--- 85,89 ----
      for line in lines:
          if line[:keylen] == key:
!             working_file = line[keylen:].strip()
              break
      else:
***************
*** 94,98 ****
          dateline = lines[1]
          text = lines[2:]
!         words = string.split(dateline)
          author = None
          if len(words) >= 3 and words[0] == 'date:':
--- 94,98 ----
          dateline = lines[1]
          text = lines[2:]
!         words = dateline.split()
          author = None
          if len(words) >= 3 and words[0] == 'date:':
***************
*** 109,113 ****
              date = None
              text.insert(0, revline)
!         words = string.split(revline)
          if len(words) >= 2 and words[0] == 'revision':
              rev = words[1]
--- 109,113 ----
              date = None
              text.insert(0, revline)
!         words = revline.split()
          if len(words) >= 2 and words[0] == 'revision':
              rev = words[1]

Index: mailerdaemon.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/mailerdaemon.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mailerdaemon.py	17 Jan 2001 08:48:39 -0000	1.9
--- mailerdaemon.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 1,5 ****
  """mailerdaemon - classes to parse mailer-daemon messages"""
  
- import string
  import rfc822
  import calendar
--- 1,4 ----
***************
*** 19,25 ****
          if not sub:
              return 0
!         sub = string.lower(sub)
!         if sub[:12] == 'waiting mail': return 1
!         if string.find(sub, 'warning') >= 0: return 1
          self.sub = sub
          return 0
--- 18,24 ----
          if not sub:
              return 0
!         sub = sub.lower()
!         if sub.startswith('waiting mail'): return 1
!         if 'warning' in sub: return 1
          self.sub = sub
          return 0
***************
*** 133,140 ****
                  for i in range(len(emails)-1,-1,-1):
                      email = emails[i]
!                     exp = re.compile(string.join(string.split(regexp, '<>'), re.escape(email)), re.MULTILINE)
                      res = exp.search(data)
                      if res is not None:
!                         errors.append(string.join(string.split(string.strip(email)+': '+res.group('reason'))))
                          del emails[i]
                  continue
--- 132,139 ----
                  for i in range(len(emails)-1,-1,-1):
                      email = emails[i]
!                     exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE)
                      res = exp.search(data)
                      if res is not None:
!                         errors.append(' '.join((email.strip()+': '+res.group('reason')).split()))
                          del emails[i]
                  continue
***************
*** 144,148 ****
                  break
      for email in emails:
!         errors.append(string.join(string.split(string.strip(email)+': '+reason)))
      return errors
  
--- 143,147 ----
                  break
      for email in emails:
!         errors.append(' '.join((email.strip()+': '+reason).split()))
      return errors
  
***************
*** 150,155 ****
  
  def sort_numeric(a, b):
!     a = string.atoi(a)
!     b = string.atoi(b)
      if a < b: return -1
      elif a > b: return 1
--- 149,154 ----
  
  def sort_numeric(a, b):
!     a = int(a)
!     b = int(b)
      if a < b: return -1
      elif a > b: return 1

Index: methfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/methfix.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** methfix.py	17 Jan 2001 09:13:33 -0000	1.6
--- methfix.py	11 Sep 2002 20:36:01 -0000	1.7
***************
*** 31,35 ****
  import os
  from stat import *
- import string
  
  err = sys.stderr.write
--- 31,34 ----
***************
*** 102,106 ****
          if lineno == 1 and g is None and line[:2] == '#!':
              # Check for non-Python scripts
!             words = string.split(line[2:])
              if words and regex.search('[pP]ython', words[0]) < 0:
                  msg = filename + ': ' + words[0]
--- 101,105 ----
          if lineno == 1 and g is None and line[:2] == '#!':
              # Check for non-Python scripts
!             words = line[2:].split()
              if words and regex.search('[pP]ython', words[0]) < 0:
                  msg = filename + ': ' + words[0]

Index: nm2def.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/nm2def.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** nm2def.py	17 Jan 2001 08:48:39 -0000	1.4
--- nm2def.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 35,39 ****
  
  """
! import os,re,string,sys
  
  PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
--- 35,39 ----
  
  """
! import os,re,sys
  
  PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
***************
*** 44,53 ****
  
      lines = os.popen(NM % lib).readlines()
!     lines = map(string.strip,lines)
      symbols = {}
      for line in lines:
          if len(line) == 0 or ':' in line:
              continue
!         items = string.split(line)
          if len(items) != 3:
              continue
--- 44,53 ----
  
      lines = os.popen(NM % lib).readlines()
!     lines = [s.strip() for s in lines]
      symbols = {}
      for line in lines:
          if len(line) == 0 or ':' in line:
              continue
!         items = line.split()
          if len(items) != 3:
              continue
***************
*** 70,74 ****
      data.append('')
      code.sort()
!     return string.join(data,' DATA\n')+'\n'+string.join(code,'\n')
  
  # Definition file template
--- 70,74 ----
      data.append('')
      code.sort()
!     return ' DATA\n'.join(data)+'\n'+'\n'.join(code)
  
  # Definition file template

Index: objgraph.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/objgraph.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** objgraph.py	17 Jan 2001 08:48:39 -0000	1.5
--- objgraph.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 21,25 ****
  
  import sys
- import string
  import os
  import getopt
--- 21,24 ----

Index: pathfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pathfix.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pathfix.py	17 Jan 2001 09:13:33 -0000	1.4
--- pathfix.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 24,28 ****
  import os
  from stat import *
- import string
  import getopt
  
--- 24,27 ----
***************
*** 141,147 ****
  
  def fixline(line):
!     if line[:2] != '#!':
          return line
!     if string.find(line, "python") < 0:
          return line
      return '#! %s\n' % new_interpreter
--- 140,146 ----
  
  def fixline(line):
!     if not line.startswith('#!'):
          return line
!     if "python" not in line:
          return line
      return '#! %s\n' % new_interpreter

Index: pdeps.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pdeps.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pdeps.py	17 Jan 2001 08:48:39 -0000	1.5
--- pdeps.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 24,28 ****
  import regex
  import os
- import string
  
  
--- 24,27 ----
***************
*** 83,90 ****
              (a, b), (a1, b1) = m_from.regs[:2]
          else: continue
!         words = string.splitfields(line[a1:b1], ',')
          # print '#', line, words
          for word in words:
!             word = string.strip(word)
              if word not in list:
                  list.append(word)
--- 82,89 ----
              (a, b), (a1, b1) = m_from.regs[:2]
          else: continue
!         words = line[a1:b1].split(',')
          # print '#', line, words
          for word in words:
!             word = word.strip()
              if word not in list:
                  list.append(word)
***************
*** 153,157 ****
          list = table[mod]
          list.sort()
!         print string.ljust(mod, maxlen), ':',
          if mod in list:
              print '(*)',
--- 152,156 ----
          list = table[mod]
          list.sort()
!         print mod.ljust(maxlen), ':',
          if mod in list:
              print '(*)',

Index: pindent.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pindent.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pindent.py	17 Jan 2001 08:48:39 -0000	1.10
--- pindent.py	11 Sep 2002 20:36:01 -0000	1.11
***************
*** 84,88 ****
  import os
  import re
- import string
  import sys
  
--- 84,87 ----
***************
*** 120,124 ****
      def write(self, line):
          if self.expandtabs:
!             self._write(string.expandtabs(line, self.tabsize))
          else:
              self._write(line)
--- 119,123 ----
      def write(self, line):
          if self.expandtabs:
!             self._write(line.expandtabs(self.tabsize))
          else:
              self._write(line)
***************
*** 271,275 ****
                  # end if
              # end if
!             indent = len(string.expandtabs(line[:i], self.tabsize))
              while indent < current:
                  if firstkw:
--- 270,274 ----
                  # end if
              # end if
!             indent = len(line[:i].expandtabs(self.tabsize))
              while indent < current:
                  if firstkw:
***************
*** 371,375 ****
      # end def read
      def readline(self):
!         i = string.find(self.buf, '\n', self.pos)
          return self.read(i + 1 - self.pos)
      # end def readline
--- 370,374 ----
      # end def read
      def readline(self):
!         i = self.buf.find('\n', self.pos)
          return self.read(i + 1 - self.pos)
      # end def readline
***************
*** 515,521 ****
              action = 'reformat'
          elif o == '-s':
!             stepsize = string.atoi(a)
          elif o == '-t':
!             tabsize = string.atoi(a)
          elif o == '-e':
              expandtabs = 1
--- 514,520 ----
              action = 'reformat'
          elif o == '-s':
!             stepsize = int(a)
          elif o == '-t':
!             tabsize = int(a)
          elif o == '-e':
              expandtabs = 1

Index: rgrep.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/rgrep.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rgrep.py	12 Aug 1998 17:47:52 -0000	1.1
--- rgrep.py	11 Sep 2002 20:36:01 -0000	1.2
***************
*** 8,12 ****
  import sys
  import re
- import string
  import getopt
  
--- 8,11 ----
***************
*** 39,43 ****
          f.seek(pos)
          buffer = f.read(size)
!         lines = string.split(buffer, "\n")
          del buffer
          if leftover is None:
--- 38,42 ----
          f.seek(pos)
          buffer = f.read(size)
!         lines = buffer.split("\n")
          del buffer
          if leftover is None:

Index: sum5.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/sum5.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sum5.py	17 Apr 2002 21:52:01 -0000	1.4
--- sum5.py	11 Sep 2002 20:36:01 -0000	1.5
***************
*** 17,21 ****
  
  import sys
- import string
  import os
  import md5
--- 17,20 ----
***************
*** 90,94 ****
              rmode = 'r'
          if o == '-s':
!             bufsize = string.atoi(a)
      if not args: args = ['-']
      return sum(args, out)
--- 89,93 ----
              rmode = 'r'
          if o == '-s':
!             bufsize = int(a)
      if not args: args = ['-']
      return sum(args, out)

Index: trace.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** trace.py	15 Aug 2002 14:59:02 -0000	1.8
--- trace.py	11 Sep 2002 20:36:01 -0000	1.9
***************
*** 84,88 ****
  """
  
! import sys, os, string, tempfile, types, copy, operator, inspect, exceptions, marshal
  try:
      import cPickle
--- 84,88 ----
  """
  
! import sys, os, tempfile, types, copy, operator, inspect, exceptions, marshal
  try:
      import cPickle
***************
*** 178,182 ****
              #  d = "/usr/local.py"
              #  filename = "/usr/local.py"
!             if string.find(filename, d + os.sep) == 0:
                  self._ignore[modulename] = 1
                  return 1
--- 178,182 ----
              #  d = "/usr/local.py"
              #  filename = "/usr/local.py"
!             if filename.startswith(d + os.sep):
                  self._ignore[modulename] = 1
                  return 1
***************
*** 342,352 ****
                      # the text as a non-comment; no easy fix)
                      if executable_linenos.has_key(i+1) and \
!                        string.find(lines[i],
!                                    string.join(['#pragma', 'NO COVER'])) == -1:
                          outfile.write('>>>>>> ')
                      else:
                          outfile.write(' '*7)
                      n_lines = n_lines + 1
!                 outfile.write(string.expandtabs(lines[i], 8))
  
              outfile.close()
--- 342,351 ----
                      # the text as a non-comment; no easy fix)
                      if executable_linenos.has_key(i+1) and \
!                        lines[i].find(' '.join(['#pragma', 'NO COVER'])) == -1:
                          outfile.write('>>>>>> ')
                      else:
                          outfile.write(' '*7)
                      n_lines = n_lines + 1
!                 outfile.write(lines[i].expandtabs(8))
  
              outfile.close()
***************
*** 676,689 ****
  
          if opt == "--ignore-dir":
!             for s in string.split(val, os.pathsep):
                  s = os.path.expandvars(s)
                  # should I also call expanduser? (after all, could use $HOME)
  
!                 s = string.replace(s, "$prefix",
!                                    os.path.join(sys.prefix, "lib",
!                                                 "python" + sys.version[:3]))
!                 s = string.replace(s, "$exec_prefix",
!                                    os.path.join(sys.exec_prefix, "lib",
!                                                 "python" + sys.version[:3]))
                  s = os.path.normpath(s)
                  ignore_dirs.append(s)
--- 675,688 ----
  
          if opt == "--ignore-dir":
!             for s in val.split(os.pathsep):
                  s = os.path.expandvars(s)
                  # should I also call expanduser? (after all, could use $HOME)
  
!                 s = s.replace("$prefix",
!                               os.path.join(sys.prefix, "lib",
!                                            "python" + sys.version[:3]))
!                 s = s.replace("$exec_prefix",
!                               os.path.join(sys.exec_prefix, "lib",
!                                            "python" + sys.version[:3]))
                  s = os.path.normpath(s)
                  ignore_dirs.append(s)

Index: treesync.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/treesync.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** treesync.py	17 Jan 2001 08:48:39 -0000	1.5
--- treesync.py	11 Sep 2002 20:36:01 -0000	1.6
***************
*** 24,28 ****
  """
  
! import os, sys, stat, string, getopt
  
  # Interactivity options
--- 24,28 ----
  """
  
! import os, sys, stat, getopt
  
  # Interactivity options
***************
*** 98,102 ****
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = string.split(e, '/')
              if words[0] == '' and words[1:]:
                  name = words[1]
--- 98,102 ----
          entries = os.path.join(cvsdir, "Entries")
          for e in open(entries).readlines():
!             words = e.split('/')
              if words[0] == '' and words[1:]:
                  name = words[1]
***************
*** 189,196 ****
  
  def okay(prompt, answer='ask'):
!     answer = string.lower(string.strip(answer))
      if not answer or answer[0] not in 'ny':
          answer = raw_input(prompt)
!         answer = string.lower(string.strip(answer))
          if not answer:
              answer = default_answer
--- 189,196 ----
  
  def okay(prompt, answer='ask'):
!     answer = answer.strip().lower()
      if not answer or answer[0] not in 'ny':
          answer = raw_input(prompt)
!         answer = answer.strip().lower()
          if not answer:
              answer = default_answer

Index: untabify.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/untabify.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** untabify.py	20 Oct 1998 15:33:33 -0000	1.2
--- untabify.py	11 Sep 2002 20:36:01 -0000	1.3
***************
*** 5,9 ****
  import os
  import sys
- import string
  import getopt
  
--- 5,8 ----
***************
*** 33,37 ****
          print "%s: I/O error: %s" % (`file`, str(msg))
          return
!     newtext = string.expandtabs(text, tabsize)
      if newtext == text:
          return
--- 32,36 ----
          print "%s: I/O error: %s" % (`file`, str(msg))
          return
!     newtext = text.expandtabs(tabsize)
      if newtext == text:
          return

Index: which.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/which.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** which.py	17 Jan 2001 08:48:39 -0000	1.9
--- which.py	11 Sep 2002 20:36:01 -0000	1.10
***************
*** 8,12 ****
  if sys.path[0] in (".", ""): del sys.path[0]
  
! import sys, os, string
  from stat import *
  
--- 8,12 ----
  if sys.path[0] in (".", ""): del sys.path[0]
  
! import sys, os
  from stat import *
  
***************
*** 14,18 ****
      sys.stderr.write(str + '\n')
  
! pathlist = string.splitfields(os.environ['PATH'], ':')
  
  sts = 0
--- 14,18 ----
      sys.stderr.write(str + '\n')
  
! pathlist = os.environ['PATH'].split(':')
  
  sts = 0

Index: xxci.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/xxci.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** xxci.py	17 Jan 2001 08:48:39 -0000	1.14
--- xxci.py	11 Sep 2002 20:36:01 -0000	1.15
***************
*** 10,14 ****
  import commands
  import fnmatch
- import string
  
  EXECMAGIC = '\001\140\000\010'
--- 10,13 ----
***************
*** 58,62 ****
      except IOError:
          return
!     ignore[:] = ignore + string.split(f.read())
  
  def skipfile(file):
--- 57,61 ----
      except IOError:
          return
!     ignore[:] = ignore + f.read().split()
  
  def skipfile(file):