[Python-Dev] PEP 229 checked in

Guido van Rossum guido@digicool.com
Fri, 19 Jan 2001 17:06:03 -0500


I finally figured the best way to fix sys.path to find shared modules
built by setup.py.  At first I thought I had to add it to getpath.c,
but the problem is that the name is calculated by calling
distutils.util.get_platform(), and that requires a working Python
interpreter, so we'd end up with a chicken-or-egg situation.

So instead I added 5 lines to site.py, which tests for
os.name=='posix', then for sys.path[-1] ending in '/Modules' -- this
tests only succeeds when running from the build directory.  Then it
calls distutils.util.get_platform() and uses the result to calculate
the correct directory name, which is then appended to sys.path.

Yes, this slows down startup (it imports a large portion of the
distutils package), but I don't care -- after all this is mostly for
me so I can play with the interpreter right after I've built it,
right?

--Guido van Rossum (home page: http://www.python.org/~guido/)