[Distutils] Access to Python config info

Greg Ward gward@cnri.reston.va.us
Thu, 17 Dec 1998 18:36:16 -0500


Quoth Fred L. Drake, on 17 December 1998:
>   I've attached a sysconfig.py that works on Unix.  Someone familiar
> with other platforms will need to make it work there as well by adding 
> additional _init_<name>() functions; <name> should be os.name.  When
> run as a script, it rewrites itself with the discovered information.

Cool!  I have two itty-bitty teeny-tiny nits to pick:

> """Prototype sysconfig module that loads information when run as a script,
> but only defines constants when imported.
> 
> This should be run as a script as one of the last steps of the Python
> installation process.
> """

*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
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. 

But for the first version of distutils, I think this is what we need.

>     # 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
(because of the .'s where there should be \( and \)), but it's a bit
inexact.  (Feel free to slap me with a wet noodle if I'm missing
something obvious here.)

Well, Fred, you've set the ball rolling... I guess coding and design
will, as usual, proceed hand-in-hand... ;-)

        Greg

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
kind (I'm partial to $Id$ myself, but $Revision$ is also fine).  Any
objections?

P.P.S. I'll see about getting an anonymous CVS archive set up tonight or 
tomorrow.

-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913