[Python-checkins] CVS: python/dist/src/Lib compileall.py,1.9,1.10

Martin v. L?wis loewis@users.sourceforge.net
Mon, 18 Mar 2002 04:44:10 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv8132/Lib

Modified Files:
	compileall.py 
Log Message:
Patch #495598: add an -q (quiet) option to pycompile.


Index: compileall.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compileall.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** compileall.py	18 Apr 2001 01:20:21 -0000	1.9
--- compileall.py	18 Mar 2002 12:44:08 -0000	1.10
***************
*** 20,24 ****
  __all__ = ["compile_dir","compile_path"]
  
! def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None):
      """Byte-compile all modules in the given directory tree.
  
--- 20,25 ----
  __all__ = ["compile_dir","compile_path"]
  
! def compile_dir(dir, maxlevels=10, ddir=None,
!                 force=0, rx=None, quiet=0):
      """Byte-compile all modules in the given directory tree.
  
***************
*** 30,36 ****
                 directory name that will show up in error messages)
      force:     if 1, force compilation, even if timestamps are up-to-date
  
      """
!     print 'Listing', dir, '...'
      try:
          names = os.listdir(dir)
--- 31,39 ----
                 directory name that will show up in error messages)
      force:     if 1, force compilation, even if timestamps are up-to-date
+     quiet:     if 1, be quiet during compilation
  
      """
!     if not quiet:
!         print 'Listing', dir, '...'
      try:
          names = os.listdir(dir)
***************
*** 58,62 ****
                  except os.error: ctime = 0
                  if (ctime > ftime) and not force: continue
!                 print 'Compiling', fullname, '...'
                  try:
                      ok = py_compile.compile(fullname, None, dfile)
--- 61,66 ----
                  except os.error: ctime = 0
                  if (ctime > ftime) and not force: continue
!                 if not quiet:
!                     print 'Compiling', fullname, '...'
                  try:
                      ok = py_compile.compile(fullname, None, dfile)
***************
*** 78,86 ****
               os.path.isdir(fullname) and \
               not os.path.islink(fullname):
!             if not compile_dir(fullname, maxlevels - 1, dfile, force, rx):
                  success = 0
      return success
  
! def compile_path(skip_curdir=1, maxlevels=0, force=0):
      """Byte-compile all module on sys.path.
  
--- 82,90 ----
               os.path.isdir(fullname) and \
               not os.path.islink(fullname):
!             if not compile_dir(fullname, maxlevels - 1, dfile, force, rx, quiet):
                  success = 0
      return success
  
! def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
      """Byte-compile all module on sys.path.
  
***************
*** 90,93 ****
--- 94,98 ----
      maxlevels:   max recursion level (default 0)
      force: as for compile_dir() (default 0)
+     quiet: as for compile_dir() (default 0)
  
      """
***************
*** 97,101 ****
              print 'Skipping current directory'
          else:
!             success = success and compile_dir(dir, maxlevels, None, force)
      return success
  
--- 102,107 ----
              print 'Skipping current directory'
          else:
!             success = success and compile_dir(dir, maxlevels, None,
!                                               force, quiet=quiet)
      return success
  
***************
*** 104,114 ****
      import getopt
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:')
      except getopt.error, msg:
          print msg
!         print "usage: python compileall.py [-l] [-f] [-d destdir] " \
                "[-s regexp] [directory ...]"
          print "-l: don't recurse down"
          print "-f: force rebuild even if timestamps are up-to-date"
          print "-d destdir: purported directory name for error messages"
          print "   if no directory arguments, -l sys.path is assumed"
--- 110,121 ----
      import getopt
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:')
      except getopt.error, msg:
          print msg
!         print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
                "[-s regexp] [directory ...]"
          print "-l: don't recurse down"
          print "-f: force rebuild even if timestamps are up-to-date"
+         print "-q: quiet operation"
          print "-d destdir: purported directory name for error messages"
          print "   if no directory arguments, -l sys.path is assumed"
***************
*** 119,122 ****
--- 126,130 ----
      ddir = None
      force = 0
+     quiet = 0
      rx = None
      for o, a in opts:
***************
*** 124,127 ****
--- 132,136 ----
          if o == '-d': ddir = a
          if o == '-f': force = 1
+         if o == '-q': quiet = 1
          if o == '-x':
              import re
***************
*** 135,139 ****
          if args:
              for dir in args:
!                 if not compile_dir(dir, maxlevels, ddir, force, rx):
                      success = 0
          else:
--- 144,149 ----
          if args:
              for dir in args:
!                 if not compile_dir(dir, maxlevels, ddir,
!                                    force, rx, quiet):
                      success = 0
          else: