[Python-checkins] CVS: distutils/distutils sysconfig.py,1.25,1.26

Greg Ward python-dev@python.org
Thu, 14 Sep 2000 17:03:20 -0700


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

Modified Files:
	sysconfig.py 
Log Message:
Fixed so 'parse_makefile()' uses the TextFile class to ensure that
comments are stripped and lines are joined according to the backslash
convention.

Index: sysconfig.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/sysconfig.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** sysconfig.py	2000/09/01 01:23:26	1.25
--- sysconfig.py	2000/09/15 00:03:13	1.26
***************
*** 155,159 ****
      return g
  
! def parse_makefile(fp, g=None):
      """Parse a Makefile-style file.
  
--- 155,159 ----
      return g
  
! def parse_makefile(fn, g=None):
      """Parse a Makefile-style file.
  
***************
*** 163,175 ****
  
      """
      if g is None:
          g = {}
!     variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)\n")
      done = {}
      notdone = {}
!     #
      while 1:
          line = fp.readline()
!         if not line:
              break
          m = variable_rx.match(line)
--- 163,178 ----
  
      """
+     from distutils.text_file import TextFile
+     fp = TextFile(fn, strip_comments=1, join_lines=1)
+ 
      if g is None:
          g = {}
!     variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
      done = {}
      notdone = {}
! 
      while 1:
          line = fp.readline()
!         if line is None:
              break
          m = variable_rx.match(line)
***************
*** 234,238 ****
      try:
          filename = get_makefile_filename()
!         file = open(filename)
      except IOError, msg:
          my_msg = "invalid Python installation: unable to open %s" % filename
--- 237,241 ----
      try:
          filename = get_makefile_filename()
!         parse_makefile(filename, g)
      except IOError, msg:
          my_msg = "invalid Python installation: unable to open %s" % filename
***************
*** 242,246 ****
          raise DistutilsPlatformError, my_msg
                
-     parse_makefile(file, g)
      
      # On AIX, there are wrong paths to the linker scripts in the Makefile
--- 245,248 ----