[Python-Dev] I think setup.py needs major rework

Kurt B. Kaiser kbk at shore.net
Wed Jan 26 21:50:54 CET 2005


Skip Montanaro <skip at pobox.com> writes:

>     Python's setup.py has grown way out of control.  I'm trying to
>     build and install Python 2.4.0 on a Solaris system with Tcl/Tk
>     installed in a non-standard place and I can't figure out the
>     incantation to tell setup.py to look where they are installed.

This may be more due to the complexity of distutils than to setup.py
itself.  Special cases are special cases, after all, e.g. look at
Autotools.

setup.py is billed as "Autodetecting setup.py script for building
the Python extensions" but exactly how to override it without hacking
it isn't very well documented, when possible at all.

"Distributing Python Modules" helped me, but the reference section
is missing, so it's utsl from there.

So one improvement would be to better document overriding setup.py in
README.

Your solution may be as simple as adding to Makefile:342 (approx)

--include-dirs=xxxx --library-dirs=yyyy

where setup.py is called.  (distutils/command/build_ext.py)

*But* I suspect build() may not pass the options through to build_ext()!

So, a config file approach:

.../src/setup.cfg:
[build_ext]
include-dirs=xxxx
library-dirs=yyyy


In setup.py, PyBuildExt.build_extension() does most of the special
casing.  The last thing done is to call PyBuildExt.detect_tkinter()
which handles a bunch of platform incompatibilities. e.g.

 # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, but
 # the include subdirs are named like .../include/tcl8.3.

If the previous ideas flub, you could hack your detect_tkinter() and
append your include and lib dirs to inc_dirs and lib_dirs at the
beginning of the method.

All else fails, use Modules/Setup.dist to install Tcl/Tk?

Or maybe symlink your non-standard location?

-- 
KBK


More information about the Python-Dev mailing list