[Distutils] Anonymous CVS up-and-running

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Mon, 21 Dec 1998 14:45:54 -0500 (EST)


John Skaller writes:
 > ---------------------------------------------
 >         Please put my compilers module in it too.
 > It provides the high level abstract interface that is actually needed.

  Good idea.  For those of use that haven't had time to play with
interscript, having it available in the repository would make it
easier to look at.  ;-)  It'll also make it easier to modify it as we
go along without John having to maintain compatibility with working
versions of interscript; there's no reason to tie John's release
schedule with our bickering.

 > I have incorporated the sysconfig module into interscript.
 > Here are my comments on the sysconfig module.

  Cool!

 > 1) C++ is not supported. If the option is not provided to build
 > py++, a separate distribution may follow. Do we want that?

  Agreed.  I seem to recall someone had sent patches to support C++,
possibly to the C++-SIG.  Does anyone know exactly what's needed?

 > 2) Some of the data, such as CFLAGS, is useless because it reflects
 > the python source build tree. On my system 

  Misc/Makefile.pre.in manages to get things right in practice; some
time needs to go into figuring out just how it does things and get
sysconfig to do the right thing as well.  I won't have time for it
today; may in January.  ;-(

 > 3) The directory for config.h is WRONG!
 > config.h lives in

  What definition are you looking at?

 > 4) On my system:
 > 
 >         SIZEOF_INT = '4'

  Patch attached which gets this right in a general fashion.

 > 5) I think the module should NOT just put values
 > into itself like

  I don't see any need to complicate the interface.

 > 6) There is no information from Setup. It would be useful to
 > get the Tcl/Tk library and headers into the configuration
 > if it was built. Hmmm. :(

  Variables defined in Setup & friends are included.  Otherwise,
nothing from Setup is included.  This can be changed.  It may make
sense to use a separate module for this (modconfig?).

 > 7) _init_posix should NOT modify a dictionary, but return one:
 > CHANGE:

  This item is tightly related to item 5; let's deal with that one as
the real issue.  The rest will fall out of that result.

 > 8) LINKCC = ' gcc' has a bad leading space.

  Fixed in the patch.

 > 9) I have no idea how to use the available information.
 > There are flags all over the place.

  Yes, that's what configure produces.  The next layer needs to put
this information together in a usable form.  Reading the Makefile
should help a lot in determining how the various bits should be put
together.


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives
1895 Preston White Dr.	    Reston, VA  20191


Index: sysconfig.py
===================================================================
RCS file: /projects/cvsroot/distutils/distutils/sysconfig.py,v
retrieving revision 1.1
diff -c -c -r1.1 sysconfig.py
*** sysconfig.py	1998/12/18 23:46:33	1.1
--- sysconfig.py	1998/12/21 19:43:10
***************
*** 15,20 ****
--- 15,21 ----
  def _init_posix():
      import os
      import re
+     import string
      import sys
  
      g = globals()
***************
*** 35,44 ****
          m = define_rx.match(line)
          if m:
              n, v = m.group(1, 2)
!             if v == "1":
!                 g[n] = 1
!             else:
!                 g[n] = v
          else:
              m = undef_rx.match(line)
              if m:
--- 36,44 ----
          m = define_rx.match(line)
          if m:
              n, v = m.group(1, 2)
!             try: v = string.atoi(v)
!             except ValueError: pass
!             g[n] = v
          else:
              m = undef_rx.match(line)
              if m:
***************
*** 57,65 ****
--- 57,68 ----
          m = variable_rx.match(line)
          if m:
              n, v = m.group(1, 2)
+             v = string.strip(v)
              if "$" in v:
                  notdone[n] = v
              else:
+                 try: v = string.atoi(v)
+                 except ValueError: pass
                  done[n] = v
  
      # do variable interpolation here
***************
*** 79,85 ****
                      if "$" in after:
                          notdone[name] = value
                      else:
!                         done[name] = value
                          del notdone[name]
                  elif notdone.has_key(n):
                      # get it on a subsequent round
--- 82,90 ----
                      if "$" in after:
                          notdone[name] = value
                      else:
!                         try: value = string.atoi(value)
!                         except ValueError: pass
!                         done[name] = string.strip(value)
                          del notdone[name]
                  elif notdone.has_key(n):
                      # get it on a subsequent round
***************
*** 91,99 ****
                      if "$" in after:
                          notdone[name] = value
                      else:
!                         done[name] = value
                          del notdone[name]
              else:
                  del notdone[name]
  
      # save the results in the global dictionary
--- 96,107 ----
                      if "$" in after:
                          notdone[name] = value
                      else:
!                         try: value = string.atoi(value)
!                         except ValueError: pass
!                         done[name] = string.strip(value)
                          del notdone[name]
              else:
+                 # bogus variable reference; just drop it since we can't deal
                  del notdone[name]
  
      # save the results in the global dictionary