[Python-Dev] Re: Detecting install time

Andrew Kuchling akuchlin@mems-exchange.org
Tue, 16 Jan 2001 16:53:22 -0500


[CC'ing to the distutils-sig]

On Mon, Jan 15, 2001 at 10:47:32PM -0500, Guido van Rossum wrote:
>> For PEP 229, the setup.py script needs to figure out if it's running
>> from the build directory, because then distutils.sysconfig needs to
>
>You could check for the presence of config.status -- that file is not
>installed.

This isn't a check suitable for inclusion in distutils.sysconfig,
though, because it's so liable to being fooled (consider a
Distutils-packaged module that comes with a configure script to build
some library).  Right now I'm using a hacked version of sysconfig with several patches like this:

@@ -120,12 +121,16 @@
 def get_config_h_filename():
     """Return full pathname of installed config.h file."""
     inc_dir = get_python_inc(plat_specific=1)
+    # XXX
+    if 1: inc_dir = '.'
     return os.path.join(inc_dir, "config.h")
 
One hackish approach would be to add a assume_build_directories() to
distutils.sysconfig, a little back door to be used by the setup.py
script that comes with Python, so the above would become 'if
build_time_flag: ...'.  Anyone have a cleaner idea?

--amk