[Distutils] Proposal: standard sysconfig module

M.-A. Lemburg mal@lemburg.com
Wed, 16 Dec 1998 11:41:21 +0100

Greg Ward wrote:
> In particular, my proposal is for a new 'sys.config'
> module which would contain everything you might need to know about how
> Python was configured.  The most important items are the compiler,
> compiler flags, platform, and library installation directories.

Good idea, though the module should probably be named sysconfig
(without the dot). 

I'd suggest sticking in the config.h file as
dictionary, e.g. {'HAVE_TZNAME':1, 'HAVE_TM_ZONE':0,...} and
the information from Makefile (the one in /usr/local/lib/python1.5/config)
parsed and stored in a class instance (using the same names as
in the Makefile for clarity), e.g.

sysconfig.make.CC	C compiler
              .OPT	compiler flags

Rather than discuss which things to include or not, just
put all the information in there you can find by simply parsing
Makefile. Note that the parsing mechanism should also allow
for fairly decent $(VARIABLE) expansion. 

.../Setup should also go into a dictionary: {'cPickle.c':'cPickle.c',...}

Why dictionaries for config.h and Setup and an instance for
make ? Because the Makefile entries will not change to often
and the class can provide reasonable defaults. config.h and
Setup change a lot between versions and maintaining them as
instances would probably cause lot's of compatibility

The remaining problem (?) is where to find the three files. Looking at
my Makefile they seem to be at:

sys.prefix + '/lib/python' + sys.version[:3] + '/config/'


sys.prefix + '/include/python' + sys.version[:3] + '/'

But the install dirs are changeable during configure... we might
need some help from Guido here, e.g. the sys module could
include the information: sys.configdir, sys.incldir and sys.libdir.

Note that the configuration for WinXX is hard-coded, so the
sysconfig module could also provide the data on those platforms.

Together with the other information in sys and os.environ this
should provide a pretty complete picture of how the machine
is setup.

Marc-Andre Lemburg                               Y2000: 380 days left
          : Python Pages >>> http://starship.skyport.net/~lemburg/  :