[Python-Dev] Making setup.py a little more flexible

Greg Ward gward@python.net
Wed, 3 Oct 2001 18:13:04 -0400


Some months ago, I tried to build the latest Python on an IRIX 6.5
system that has been, shall we say, lightly maintained for some time.
(Basically, its /usr/local/ is mounted from an IRIX 5 system, and it's
full of libraries that you can't link against with the default compiler
flags on IRIX 6.)

Unfortunately, Python's setup.py is a bit too rigid: it assumes that it
should always add /usr/local/{lib,include} to the lib/include search
paths, it assumes it should always search /usr/local/lib (and a few
others) for SSL libraries, etc.  Worse, it assumes the existence of
libssl.a implies the linkability of -lssl -- when /usr/local is broken,
this ain't necessarily so.

Now I know what the Right Answer is: finish implementing the Distutils
"config" command, and use it to properly probe the system for includable
header files and linkable libraries, rather than just assuming existence
== validity.

That would be nice.  But I've got a quick 'n easy fix -- the moral
equivalent of commenting out the code in PyBuildExt.detect_modules()
that makes those blithe assumptions.  Namely, I added --without-usrlocal
and --without-ssl options to the custom build_ext command used by
setup.py.

Now, I can build most extensions just fine on this broken IRIX system
like this:
  ./python setup.py build_ext --without-ssl --without-usrlocal

I've just uploaded patch #467650 (assigned to Andrew) to implement this:
  http://sourceforge.net/tracker/index.php?func=detail&aid=467650&group_id=5470&atid=305470

Whaddya think?  Good enough bandaid solution?  Or should I add a few
more things, eg.:
  --with-ssl-lib=DIR     directory to search for OpenSSL libs
  --with-ssl-inc=DIR     directory to search for OpenSSL headers
  --without-foo          don't try to build foo

The last one could be repeated for various values of "foo": curses, dbm,
bsddb, etc.  I don't think that's too necessary; if some foo doesn't
build, then it doesn't build and that's that.  From my cursory
examination of detect_modules(), the _socket/OpenSSL dependency is the
only obvious module-killer.  (That is, the bogus OpenSSL libs killed the
_socket module completely, when all I really need to do is not use
OpenSSL on this system.)

        Greg
-- 
Greg Ward - Python bigot                                gward@python.net
http://starship.python.net/~gward/
I haven't lost my mind; I know exactly where I left it.