[Distutils] Access to Python config info

Greg Stein gstein@lyra.org
Wed, 16 Dec 1998 13:37:33 -0800


M.-A. Lemburg wrote:
> ...
> Greg Ward wrote:
> > No!  At least not in the long term: as Greg Stein pointed out, the
> > config module (whatever it gets called) should just be generated when
> > Python is built.  Or were you talking about the near term, where we will
> > need a distutils release that works with Python 1.5.2 and is allowed all
> > manner of grotesque hackery to work around the lack of a config module,
> > such as digging up and parsing Python's config.h, Makefile, and Setup?
> 
> I wouldn't consider this grotesque hackery. The idea I had
> was to have the sysconfig module initialize itself at import
> time (rather than install time). Since it is not often needed
> this should be a feasable approach. Most of all it works
> without any changes to the distribution as it is, except maybe...

I don't see much of a rationale for *not* doing this at install time.
The file is a bunch of constants that are easily determined when you
build/install Python.

There is a caveat for trying to get it to function with 1.5.2, but I
don't believe that changes the long-term interface, which I maintain are
simple names/values.

> Greg Ward wrote:
> > These directories should just be accessible variables in
> > sys.config, eg.
> >
> >    sys.config.install_bindir
> >    sys.config.install_scriptdir
> >    sys.config.install_libdir
> 
> They are... once the module is initialized. But for it to find the
> necessary templates (Setup, config.h and Makefile) it needs some
> path information first. Looking at the current Makefile.pre.in
> though, it seems that this doesn't directly support non-standard install
> directories either.
> 
> The parsed information could then be stored in a _sysconfig module
> which subsequent invocations then use which is close to what Greg
> proposed except that the first run is not necessarily done by the
> installation Makefile.

It *should* be done by the installation Makefile. I would hope that we
obsolete the third-party use of Setup/config.h/Makefile.pre.in. Those
are even close to the convenience that we can establish.

So, I'd maintain that we don't need to find those three files, so there
isn't a bootstrap issue here.

Note that these files are always installed at
$(exec_prefix)/lib/python$(version)/config/ (as far as I can tell,
that's fixed).

Cheers,
-g

--
Greg Stein, http://www.lyra.org/