[Python-checkins] CVS: distutils/distutils core.py,1.35,1.36

Greg Ward python-dev@python.org
Thu, 25 May 2000 17:54:54 -0700


Update of /cvsroot/python/distutils/distutils
In directory slayer.i.sourceforge.net:/tmp/cvs-serv2916

Modified Files:
	core.py 
Log Message:
Added the DEBUG global (set from the DISTUTILS_DEBUG environment variable).
Changed the exception-handling code in 'setup()' to re-raise exceptions
  if DEBUG is true.

Index: core.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/core.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** core.py	2000/05/23 03:54:16	1.35
--- core.py	2000/05/26 00:54:52	1.36
***************
*** 8,12 ****
  # created 1999/03/01, Greg Ward
  
! __revision__ = "$Id: core.py,v 1.35 2000/05/23 03:54:16 gward Exp $"
  
  import sys, os
--- 8,12 ----
  # created 1999/03/01, Greg Ward
  
! __revision__ = "$Id: core.py,v 1.36 2000/05/26 00:54:52 gward Exp $"
  
  import sys, os
***************
*** 28,31 ****
--- 28,36 ----
  
  
+ # If DISTUTILS_DEBUG is anything other than the empty string, we run in
+ # debug mode.
+ DEBUG = os.environ.get('DISTUTILS_DEBUG')
+ 
+ 
  def setup (**attrs):
      """The gateway to the Distutils: do everything your setup script
***************
*** 102,118 ****
              if hasattr (exc, 'filename') and hasattr (exc, 'strerror'):
                  if exc.filename:
!                     raise SystemExit, \
!                           "error: %s: %s" % (exc.filename, exc.strerror)
                  else:
                      # two-argument functions in posix module don't
                      # include the filename in the exception object!
!                     raise SystemExit, \
!                           "error: %s" % exc.strerror
              else:
!                 raise SystemExit, "error: " + str(exc[-1])
          except (DistutilsExecError,
                  DistutilsFileError,
                  DistutilsOptionError), msg:
!             raise SystemExit, "error: " + str(msg)
  
  # setup ()
--- 107,131 ----
              if hasattr (exc, 'filename') and hasattr (exc, 'strerror'):
                  if exc.filename:
!                     error = "error: %s: %s" % (exc.filename, exc.strerror)
                  else:
                      # two-argument functions in posix module don't
                      # include the filename in the exception object!
!                     error = "error: %s" % exc.strerror
              else:
!                 error = "error: " + str(exc[-1])
! 
!             if DEBUG:
!                 sys.stderr.write(error + "\n")
!                 raise
!             else:
!                 raise SystemExit, error
!             
          except (DistutilsExecError,
                  DistutilsFileError,
                  DistutilsOptionError), msg:
!             if DEBUG:
!                 raise
!             else:
!                 raise SystemExit, "error: " + str(msg)
  
  # setup ()