[Distutils] Access to Python config info

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Fri, 18 Dec 1998 11:55:14 -0500 (EST)

Greg Ward writes:
 > *This* version should run as one of the last steps of the distutils
 > installation process, ie. this is the hack that'll work with Python

  If we can agree that it includes sufficient information, and we can
get the other platforms supported, why can't we ask Guido to include
it in 1.5.2?  That would also allow other projects that have differing 
views to use the same fundamental information.  That way running it is 
only needed as part of the Python build/install (should be install,
esp. for people using things like RPM, where the locations may change
after the build).

 > 1.5.2.  The nice version that will be bundled with Python 1.6 (I'm
 > hoping!) might just be this again, or it might have more direct
 > knowledge of Python's configure-time information.  But it should run as
 > part of Python's build process, so it won't go looking in
 > sys.exec_prefix + lib + python + ... -- it'll just find stuff in the
 > current (Python build) directory. 

  Stuffing in the build directory isn't useful.
  Now that you have me thinking about this, it perhaps *is* useful to
at least build the paths at import time.  The Python distribution is
supposed to be relocatable *after installation* for Unix (at least).
The interpreter already does a search for the libraries, and sets
sys.prefix and sys.exec_prefix accordingly (I think those get set
properly... yes, they are).
  So: the right way to do this is to set most of the paths at import
time.  This should not be hard.

 > >     # do variable interpolation here
 > >     findvar1_rx = re.compile(r"\$.([A-Za-z][A-Za-z0-9_]*).")
 > >     findvar2_rx = re.compile(r"\$.([A-Za-z][A-Za-z0-9_]*)}")
 > Ummm... is this right?  Shouldn't the first regex be for $(...) and the
 > second for ${...}?  If that's what you were thinking, this'll still work

  Ouch!  Yes.  That was a change I forgot I made while debugging
something that was entirely a different problem with the code (I was
using match() instead of search(), probably because it's usually what
I need).

 > P.S. I would like to suggest one coding standard for the project: every
 > source file should have the name and email address of the person who
 > wrote it, the date it was started, and and RCS/CVS identifier of some

  Cool.  I typically use __version__ = "$Revision$" for storing
revision control information.  This corresponds to a recommendation
from long ago; I don't recall the source, but it was probably c.l.py.
$Id$ could be added in a comment if desired, but I don't know how
useful it is since I don't use it.


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