[Python-checkins] CVS: python/dist/src/Tools/compiler compile.py,1.4,1.5

Jeremy Hylton jhylton@users.sourceforge.net
Mon, 17 Sep 2001 11:08:42 -0700


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

Modified Files:
	compile.py 
Log Message:
Add -p option to invoke Python profiler





Index: compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/compiler/compile.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** compile.py	2001/08/27 20:39:21	1.4
--- compile.py	2001/09/17 18:08:40	1.5
***************
*** 4,14 ****
  from compiler import compile, visitor
  
! ##import profile
  
  def main():
      VERBOSE = 0
      DISPLAY = 0
      CONTINUE = 0
!     opts, args = getopt.getopt(sys.argv[1:], 'vqdc')
      for k, v in opts:
          if k == '-v':
--- 4,15 ----
  from compiler import compile, visitor
  
! import profile
  
  def main():
      VERBOSE = 0
      DISPLAY = 0
+     PROFILE = 0
      CONTINUE = 0
!     opts, args = getopt.getopt(sys.argv[1:], 'vqdcp')
      for k, v in opts:
          if k == '-v':
***************
*** 25,28 ****
--- 26,31 ----
          if k == '-c':
              CONTINUE = 1
+         if k == '-p':
+             PROFILE = 1
      if not args:
          print "no files to compile"
***************
*** 32,38 ****
                  print filename
              try:
!                 compile(filename, DISPLAY)
! ##                profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`),
! ##                            filename + ".prof")
              except SyntaxError, err:
                  print err
--- 35,44 ----
                  print filename
              try:
!                 if PROFILE:
!                     profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`),
!                                 filename + ".prof")
!                 else:
!                     compile(filename, DISPLAY)
!                     
              except SyntaxError, err:
                  print err