[Python-checkins] python/dist/src/Tools/scripts byteyears.py,1.8,1.9 dutree.py,1.11,1.12 eptags.py,1.8,1.9 finddiv.py,1.1,1.2 fixdiv.py,1.7,1.8 fixheader.py,1.5,1.6 fixps.py,1.5,1.6 ftpmirror.py,1.17,1.18 ifdef.py,1.5,1.6 mkreal.py,1.6,1.7 objgraph.py,1.6,1.7 pindent.py,1.11,1.12 ptags.py,1.7,1.8 suff.py,1.5,1.6 untabify.py,1.3,1.4 which.py,1.10,1.11

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Tue, 13 May 2003 11:14:28 -0700


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

Modified Files:
	byteyears.py dutree.py eptags.py finddiv.py fixdiv.py 
	fixheader.py fixps.py ftpmirror.py ifdef.py mkreal.py 
	objgraph.py pindent.py ptags.py suff.py untabify.py which.py 
Log Message:
Fix use of 'file' as a variable name.
    (I've tested the fixes, but please proofread anyway.)


Index: byteyears.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/byteyears.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** byteyears.py	11 Sep 2002 20:36:01 -0000	1.8
--- byteyears.py	13 May 2003 18:14:24 -0000	1.9
***************
*** 35,47 ****
  # Compute max file name length
  maxlen = 1
! for file in sys.argv[1:]:
!     if len(file) > maxlen: maxlen = len(file)
  
  # Process each argument in turn
! for file in sys.argv[1:]:
      try:
!         st = statfunc(file)
      except os.error, msg:
!         sys.stderr.write('can\'t stat ' + `file` + ': ' + `msg` + '\n')
          status = 1
          st = ()
--- 35,47 ----
  # Compute max file name length
  maxlen = 1
! for filename in sys.argv[1:]:
!     maxlen = max(maxlen, len(filename))
  
  # Process each argument in turn
! for filename in sys.argv[1:]:
      try:
!         st = statfunc(filename)
      except os.error, msg:
!         sys.stderr.write('can\'t stat ' + `filename` + ': ' + `msg` + '\n')
          status = 1
          st = ()
***************
*** 51,55 ****
          age = now - anytime
          byteyears = float(size) * float(age) / secs_per_year
!         print file.ljust(maxlen),
          print repr(int(byteyears)).rjust(8)
  
--- 51,55 ----
          age = now - anytime
          byteyears = float(size) * float(age) / secs_per_year
!         print filename.ljust(maxlen),
          print repr(int(byteyears)).rjust(8)
  

Index: dutree.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/dutree.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dutree.py	11 Sep 2002 20:36:01 -0000	1.11
--- dutree.py	13 May 2003 18:14:24 -0000	1.12
***************
*** 12,17 ****
          size = eval(line[:i])
          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]
--- 12,17 ----
          size = eval(line[:i])
          while line[i] in ' \t': i = i+1
!         filename = line[i:-1]
!         comps = filename.split('/')
          if comps[0] == '': comps[0] = '/'
          if comps[len(comps)-1] == '': del comps[len(comps)-1]

Index: eptags.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/eptags.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** eptags.py	18 Sep 2000 01:46:01 -0000	1.8
--- eptags.py	13 May 2003 18:14:24 -0000	1.9
***************
*** 22,31 ****
  matcher = re.compile(expr)
  
! def treat_file(file, outfp):
!     """Append tags found in file named 'file' to the open file 'outfp'"""
      try:
!         fp = open(file, 'r')
      except:
!         sys.stderr.write('Cannot open %s\n'%file)
          return
      charno = 0
--- 22,31 ----
  matcher = re.compile(expr)
  
! def treat_file(filename, outfp):
!     """Append tags found in file named 'filename' to the open file 'outfp'"""
      try:
!         fp = open(filename, 'r')
      except:
!         sys.stderr.write('Cannot open %s\n'%filename)
          return
      charno = 0
***************
*** 40,48 ****
          m = matcher.search(line)
          if m:
!             tag = m.group(0) + '\177%d,%d\n'%(lineno,charno)
              tags.append(tag)
              size = size + len(tag)
          charno = charno + len(line)
!     outfp.write('\f\n%s,%d\n'%(file,size))
      for tag in tags:
          outfp.write(tag)
--- 40,48 ----
          m = matcher.search(line)
          if m:
!             tag = m.group(0) + '\177%d,%d\n' % (lineno, charno)
              tags.append(tag)
              size = size + len(tag)
          charno = charno + len(line)
!     outfp.write('\f\n%s,%d\n' % (filename,size))
      for tag in tags:
          outfp.write(tag)
***************
*** 50,55 ****
  def main():
      outfp = open('TAGS', 'w')
!     for file in sys.argv[1:]:
!         treat_file(file, outfp)
  
  if __name__=="__main__":
--- 50,55 ----
  def main():
      outfp = open('TAGS', 'w')
!     for filename in sys.argv[1:]:
!         treat_file(filename, outfp)
  
  if __name__=="__main__":

Index: finddiv.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/finddiv.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** finddiv.py	2 Sep 2001 04:43:30 -0000	1.1
--- finddiv.py	13 May 2003 18:14:24 -0000	1.2
***************
*** 38,43 ****
              listnames = 1
      exit = None
!     for file in args:
!         x = process(file, listnames)
          exit = exit or x
      return exit
--- 38,43 ----
              listnames = 1
      exit = None
!     for filename in args:
!         x = process(filename, listnames)
          exit = exit or x
      return exit
***************
*** 48,56 ****
      sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0])
  
! def process(file, listnames):
!     if os.path.isdir(file):
!         return processdir(file, listnames)
      try:
!         fp = open(file)
      except IOError, msg:
          sys.stderr.write("Can't open: %s\n" % msg)
--- 48,56 ----
      sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0])
  
! def process(filename, listnames):
!     if os.path.isdir(filename):
!         return processdir(filename, listnames)
      try:
!         fp = open(filename)
      except IOError, msg:
          sys.stderr.write("Can't open: %s\n" % msg)
***************
*** 61,69 ****
          if token in ("/", "/="):
              if listnames:
!                 print file
                  break
              if row != lastrow:
                  lastrow = row
!                 print "%s:%d:%s" % (file, row, line),
      fp.close()
  
--- 61,69 ----
          if token in ("/", "/="):
              if listnames:
!                 print filename
                  break
              if row != lastrow:
                  lastrow = row
!                 print "%s:%d:%s" % (filename, row, line),
      fp.close()
  

Index: fixdiv.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixdiv.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** fixdiv.py	4 Sep 2001 16:22:01 -0000	1.7
--- fixdiv.py	13 May 2003 18:14:24 -0000	1.8
***************
*** 165,170 ****
      files.sort()
      exit = None
!     for file in files:
!         x = process(file, warnings[file])
          exit = exit or x
      return exit
--- 165,170 ----
      files.sort()
      exit = None
!     for filename in files:
!         x = process(filename, warnings[filename])
          exit = exit or x
      return exit
***************
*** 195,215 ****
                  sys.stderr.write("Warning: ignored input " + line)
              continue
!         file, lineno, what = m.groups()
!         list = warnings.get(file)
          if list is None:
!             warnings[file] = list = []
          list.append((int(lineno), intern(what)))
      f.close()
      return warnings
  
! def process(file, list):
      print "-"*70
      assert list # if this fails, readwarnings() is broken
      try:
!         fp = open(file)
      except IOError, msg:
          sys.stderr.write("can't open: %s\n" % msg)
          return 1
!     print "Index:", file
      f = FileContext(fp)
      list.sort()
--- 195,215 ----
                  sys.stderr.write("Warning: ignored input " + line)
              continue
!         filename, lineno, what = m.groups()
!         list = warnings.get(filename)
          if list is None:
!             warnings[filename] = list = []
          list.append((int(lineno), intern(what)))
      f.close()
      return warnings
  
! def process(filename, list):
      print "-"*70
      assert list # if this fails, readwarnings() is broken
      try:
!         fp = open(filename)
      except IOError, msg:
          sys.stderr.write("can't open: %s\n" % msg)
          return 1
!     print "Index:", filename
      f = FileContext(fp)
      list.sort()

Index: fixheader.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixheader.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fixheader.py	11 Sep 2002 20:36:01 -0000	1.5
--- fixheader.py	13 May 2003 18:14:24 -0000	1.6
***************
*** 7,32 ****
  def main():
      args = sys.argv[1:]
!     for file in args:
!         process(file)
  
! def process(file):
      try:
!         f = open(file, 'r')
      except IOError, msg:
!         sys.stderr.write('%s: can\'t open: %s\n' % (file, str(msg)))
          return
      data = f.read()
      f.close()
      if data[:2] <> '/*':
!         sys.stderr.write('%s does not begin with C comment\n' % file)
          return
      try:
!         f = open(file, 'w')
      except IOError, msg:
!         sys.stderr.write('%s: can\'t write: %s\n' % (file, str(msg)))
          return
!     sys.stderr.write('Processing %s ...\n' % file)
      magic = 'Py_'
!     for c in file:
          if ord(c)<=0x80 and c.isalnum():
              magic = magic + c.upper()
--- 7,32 ----
  def main():
      args = sys.argv[1:]
!     for filename in args:
!         process(filename)
  
! def process(filename):
      try:
!         f = open(filename, 'r')
      except IOError, msg:
!         sys.stderr.write('%s: can\'t open: %s\n' % (filename, str(msg)))
          return
      data = f.read()
      f.close()
      if data[:2] <> '/*':
!         sys.stderr.write('%s does not begin with C comment\n' % filename)
          return
      try:
!         f = open(filename, 'w')
      except IOError, msg:
!         sys.stderr.write('%s: can\'t write: %s\n' % (filename, str(msg)))
          return
!     sys.stderr.write('Processing %s ...\n' % filename)
      magic = 'Py_'
!     for c in filename:
          if ord(c)<=0x80 and c.isalnum():
              magic = magic + c.upper()

Index: fixps.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixps.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fixps.py	17 Jan 2001 08:48:39 -0000	1.5
--- fixps.py	13 May 2003 18:14:24 -0000	1.6
***************
*** 9,21 ****
  
  def main():
!     for file in sys.argv[1:]:
          try:
!             f = open(file, 'r')
          except IOError, msg:
!             print file, ': can\'t open :', msg
              continue
          line = f.readline()
          if not re.match('^#! */usr/local/bin/python', line):
!             print file, ': not a /usr/local/bin/python script'
              f.close()
              continue
--- 9,21 ----
  
  def main():
!     for filename in sys.argv[1:]:
          try:
!             f = open(filename, 'r')
          except IOError, msg:
!             print filename, ': can\'t open :', msg
              continue
          line = f.readline()
          if not re.match('^#! */usr/local/bin/python', line):
!             print filename, ': not a /usr/local/bin/python script'
              f.close()
              continue
***************
*** 24,29 ****
          line = re.sub('/usr/local/bin/python',
                        '/usr/bin/env python', line)
!         print file, ':', `line`
!         f = open(file, "w")
          f.write(line)
          f.write(rest)
--- 24,29 ----
          line = re.sub('/usr/local/bin/python',
                        '/usr/bin/env python', line)
!         print filename, ':', `line`
!         f = open(filename, "w")
          f.write(line)
          f.write(rest)

Index: ftpmirror.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ftpmirror.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** ftpmirror.py	5 Dec 2002 02:43:14 -0000	1.17
--- ftpmirror.py	13 May 2003 18:14:24 -0000	1.18
***************
*** 385,391 ****
  # Also creates a backup file.
  def writedict(dict, filename):
!     dir, file = os.path.split(filename)
!     tempname = os.path.join(dir, '@' + file)
!     backup = os.path.join(dir, file + '~')
      try:
          os.unlink(backup)
--- 385,391 ----
  # Also creates a backup file.
  def writedict(dict, filename):
!     dir, fname = os.path.split(filename)
!     tempname = os.path.join(dir, '@' + fname)
!     backup = os.path.join(dir, fname + '~')
      try:
          os.unlink(backup)

Index: ifdef.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ifdef.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ifdef.py	11 Sep 2002 20:36:01 -0000	1.5
--- ifdef.py	13 May 2003 18:14:24 -0000	1.6
***************
*** 43,51 ****
      if not args:
          args = ['-']
!     for file in args:
!         if file == '-':
              process(sys.stdin, sys.stdout)
          else:
!             f = open(file, 'r')
              process(f, sys.stdout)
              f.close()
--- 43,51 ----
      if not args:
          args = ['-']
!     for filename in args:
!         if filename == '-':
              process(sys.stdin, sys.stdout)
          else:
!             f = open(filename, 'r')
              process(f, sys.stdout)
              f.close()

Index: mkreal.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/mkreal.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mkreal.py	17 Jan 2001 08:48:39 -0000	1.6
--- mkreal.py	13 May 2003 18:14:25 -0000	1.7
***************
*** 39,45 ****
      linkto = join(os.pardir, linkto)
      #
!     for file in files:
!         if file not in (os.curdir, os.pardir):
!             os.symlink(join(linkto, file), join(name, file))
  
  def main():
--- 39,45 ----
      linkto = join(os.pardir, linkto)
      #
!     for filename in files:
!         if filename not in (os.curdir, os.pardir):
!             os.symlink(join(linkto, filename), join(name, filename))
  
  def main():

Index: objgraph.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/objgraph.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** objgraph.py	11 Sep 2002 20:36:01 -0000	1.6
--- objgraph.py	13 May 2003 18:14:25 -0000	1.7
***************
*** 64,70 ****
  # Argument is an open file.
  #
! def readinput(file):
      while 1:
!         s = file.readline()
          if not s:
              break
--- 64,70 ----
  # Argument is an open file.
  #
! def readinput(fp):
      while 1:
!         s = fp.readline()
          if not s:
              break
***************
*** 89,95 ****
      flist = file2undef.keys()
      flist.sort()
!     for file in flist:
!         print file + ':'
!         elist = file2undef[file]
          elist.sort()
          for ext in elist:
--- 89,95 ----
      flist = file2undef.keys()
      flist.sort()
!     for filename in flist:
!         print filename + ':'
!         elist = file2undef[filename]
          elist.sort()
          for ext in elist:
***************
*** 108,119 ****
      files = file2def.keys()
      files.sort()
!     for file in files:
          callers = []
!         for label in file2def[file]:
              if undef2file.has_key(label):
                  callers = callers + undef2file[label]
          if callers:
              callers.sort()
!             print file + ':'
              lastfn = ''
              for fn in callers:
--- 108,119 ----
      files = file2def.keys()
      files.sort()
!     for filename in files:
          callers = []
!         for label in file2def[filename]:
              if undef2file.has_key(label):
                  callers = callers + undef2file[label]
          if callers:
              callers.sort()
!             print filename + ':'
              lastfn = ''
              for fn in callers:
***************
*** 122,135 ****
                  lastfn = fn
          else:
!             print file + ': unused'
  
! # Print undefine names and where they are used.
  #
  def printundef():
      undefs = {}
!     for file in file2undef.keys():
!         for ext in file2undef[file]:
              if not def2file.has_key(ext):
!                 store(undefs, ext, file)
      elist = undefs.keys()
      elist.sort()
--- 122,135 ----
                  lastfn = fn
          else:
!             print filename + ': unused'
  
! # Print undefined names and where they are used.
  #
  def printundef():
      undefs = {}
!     for filename in file2undef.keys():
!         for ext in file2undef[filename]:
              if not def2file.has_key(ext):
!                 store(undefs, ext, filename)
      elist = undefs.keys()
      elist.sort()
***************
*** 138,143 ****
          flist = undefs[ext]
          flist.sort()
!         for file in flist:
!             print '\t' + file
  
  # Print warning messages about names defined in more than one file.
--- 138,143 ----
          flist = undefs[ext]
          flist.sort()
!         for filename in flist:
!             print '\t' + filename
  
  # Print warning messages about names defined in more than one file.
***************
*** 182,190 ****
      if not args:
          args = ['-']
!     for file in args:
!         if file == '-':
              readinput(sys.stdin)
          else:
!             readinput(open(file, 'r'))
      #
      warndups()
--- 182,190 ----
      if not args:
          args = ['-']
!     for filename in args:
!         if filename == '-':
              readinput(sys.stdin)
          else:
!             readinput(open(filename, 'r'))
      #
      warndups()

Index: pindent.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pindent.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pindent.py	11 Sep 2002 20:36:01 -0000	1.11
--- pindent.py	13 May 2003 18:14:25 -0000	1.12
***************
*** 532,537 ****
      else:
          action = eval(action + '_file')
!         for file in args:
!             action(file, stepsize, tabsize, expandtabs)
          # end for
      # end if
--- 532,537 ----
      else:
          action = eval(action + '_file')
!         for filename in args:
!             action(filename, stepsize, tabsize, expandtabs)
          # end for
      # end if

Index: ptags.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ptags.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ptags.py	17 Jan 2001 08:48:39 -0000	1.7
--- ptags.py	13 May 2003 18:14:25 -0000	1.8
***************
*** 17,21 ****
  def main():
      args = sys.argv[1:]
!     for file in args: treat_file(file)
      if tags:
          fp = open('tags', 'w')
--- 17,22 ----
  def main():
      args = sys.argv[1:]
!     for filename in args:
!         treat_file(filename)
      if tags:
          fp = open('tags', 'w')
***************
*** 27,40 ****
  matcher = re.compile(expr)
  
! def treat_file(file):
      try:
!         fp = open(file, 'r')
      except:
!         sys.stderr.write('Cannot open %s\n' % file)
          return
!     base = os.path.basename(file)
      if base[-3:] == '.py':
          base = base[:-3]
!     s = base + '\t' + file + '\t' + '1\n'
      tags.append(s)
      while 1:
--- 28,41 ----
  matcher = re.compile(expr)
  
! def treat_file(filename):
      try:
!         fp = open(filename, 'r')
      except:
!         sys.stderr.write('Cannot open %s\n' % filename)
          return
!     base = os.path.basename(filename)
      if base[-3:] == '.py':
          base = base[:-3]
!     s = base + '\t' + filename + '\t' + '1\n'
      tags.append(s)
      while 1:
***************
*** 46,50 ****
              content = m.group(0)
              name = m.group(2)
!             s = name + '\t' + file + '\t/^' + content + '/\n'
              tags.append(s)
  
--- 47,51 ----
              content = m.group(0)
              name = m.group(2)
!             s = name + '\t' + filename + '\t/^' + content + '/\n'
              tags.append(s)
  

Index: suff.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/suff.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** suff.py	17 Jan 2001 08:48:39 -0000	1.5
--- suff.py	13 May 2003 18:14:25 -0000	1.6
***************
*** 10,18 ****
      files = sys.argv[1:]
      suffixes = {}
!     for file in files:
!         suff = getsuffix(file)
          if not suffixes.has_key(suff):
              suffixes[suff] = []
!         suffixes[suff].append(file)
      keys = suffixes.keys()
      keys.sort()
--- 10,18 ----
      files = sys.argv[1:]
      suffixes = {}
!     for filename in files:
!         suff = getsuffix(filename)
          if not suffixes.has_key(suff):
              suffixes[suff] = []
!         suffixes[suff].append(filename)
      keys = suffixes.keys()
      keys.sort()
***************
*** 20,28 ****
          print `suff`, len(suffixes[suff])
  
! def getsuffix(file):
      suff = ''
!     for i in range(len(file)):
!         if file[i] == '.':
!             suff = file[i:]
      return suff
  
--- 20,28 ----
          print `suff`, len(suffixes[suff])
  
! def getsuffix(filename):
      suff = ''
!     for i in range(len(filename)):
!         if filename[i] == '.':
!             suff = filename[i:]
      return suff
  

Index: untabify.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/untabify.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** untabify.py	11 Sep 2002 20:36:01 -0000	1.3
--- untabify.py	13 May 2003 18:14:25 -0000	1.4
***************
*** 21,39 ****
              tabsize = int(optvalue)
  
!     for file in args:
!         process(file, tabsize)
  
! def process(file, tabsize):
      try:
!         f = open(file)
          text = f.read()
          f.close()
      except IOError, msg:
!         print "%s: I/O error: %s" % (`file`, str(msg))
          return
      newtext = text.expandtabs(tabsize)
      if newtext == text:
          return
!     backup = file + "~"
      try:
          os.unlink(backup)
--- 21,39 ----
              tabsize = int(optvalue)
  
!     for filename in args:
!         process(filename, tabsize)
  
! def process(filename, tabsize):
      try:
!         f = open(filename)
          text = f.read()
          f.close()
      except IOError, msg:
!         print "%s: I/O error: %s" % (`filename`, str(msg))
          return
      newtext = text.expandtabs(tabsize)
      if newtext == text:
          return
!     backup = filename + "~"
      try:
          os.unlink(backup)
***************
*** 41,51 ****
          pass
      try:
!         os.rename(file, backup)
      except os.error:
          pass
!     f = open(file, "w")
      f.write(newtext)
      f.close()
!     print file
  
  if __name__ == '__main__':
--- 41,51 ----
          pass
      try:
!         os.rename(filename, backup)
      except os.error:
          pass
!     f = open(filename, "w")
      f.write(newtext)
      f.close()
!     print filename
  
  if __name__ == '__main__':

Index: which.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/which.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** which.py	11 Sep 2002 20:36:01 -0000	1.10
--- which.py	13 May 2003 18:14:25 -0000	1.11
***************
*** 26,41 ****
      ident = ()
      for dir in pathlist:
!         file = os.path.join(dir, prog)
          try:
!             st = os.stat(file)
          except os.error:
              continue
          if not S_ISREG(st[ST_MODE]):
!             msg(file + ': not a disk file')
          else:
              mode = S_IMODE(st[ST_MODE])
              if mode & 0111:
                  if not ident:
!                     print file
                      ident = st[:3]
                  else:
--- 26,41 ----
      ident = ()
      for dir in pathlist:
!         filename = os.path.join(dir, prog)
          try:
!             st = os.stat(filename)
          except os.error:
              continue
          if not S_ISREG(st[ST_MODE]):
!             msg(filename + ': not a disk file')
          else:
              mode = S_IMODE(st[ST_MODE])
              if mode & 0111:
                  if not ident:
!                     print filename
                      ident = st[:3]
                  else:
***************
*** 44,52 ****
                      else:
                          s = 'also: '
!                     msg(s + file)
              else:
!                 msg(file + ': not executable')
          if longlist:
!             sts = os.system('ls ' + longlist + ' ' + file)
              if sts: msg('"ls -l" exit status: ' + `sts`)
      if not ident:
--- 44,52 ----
                      else:
                          s = 'also: '
!                     msg(s + filename)
              else:
!                 msg(filename + ': not executable')
          if longlist:
!             sts = os.system('ls ' + longlist + ' ' + filename)
              if sts: msg('"ls -l" exit status: ' + `sts`)
      if not ident: