M.-A. Lemburg wrote:
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 etc.
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 headaches.
The remaining problem (?) is where to find the three files. Looking at my Makefile they seem to be at: ...
Actually, at the discussion, we planned on compiling them right into the interpreter. That would prevent version skews between a compiled Python and the libraries. However, now that I'm thinking about it... screw that. If "import sysconfig" picks up the wrong version, then you have plenty of other issues to deal with. I'd much rather see a .py file that a bunch of stuff compiled into the interpreter. I'd also recommend ignoring all the dictionary vs instance stuff. Just have a bunch of assignments dropped into a sysconfig.py module. IMO, it would look a lot like FCNTL.py (h2py output files). No need to get fancy with defaults and stuff. Just write the dumb file out. I agree with Marc on "just put it all in there". No reason to sort it out. Cheers, -g -- Greg Stein, http://www.lyra.org/