[Python-Dev] extension module .o files wind up in the wrong place

Skip Montanaro skip@pobox.com
Wed, 4 Dec 2002 09:17:18 -0600


    Jack> Distutils never ceases to amaze me, and it's path-mangling tricks
    Jack> are beyond me.

:-)

    Jack> I'm pretty sure that if we somehow stuff
    Jack> "../Modules/regexmodule.c" (assuming we're building in a subdir of
    Jack> the main dir) into the list of module sources we'll get something
    Jack> like build/tmp.blabla/../Modules/regexmodule.o for the object
    Jack> filename.

    Jack> Does anyone else feel up to fixing this?

I poked around a bit yesterday but didn't get too far.  Deep distutils
pondering is beyond my feeble brain.  In PyBuildExt.build_extensions() in
setup.py, you will see os.getcwd() tacked onto the front of the generated
path in a couple places.  That appears to be the cause of the absolute paths
we see.  I think removing it will be a necessary, but not sufficient,
condition for a fix.  Removing it will create a relative path, but I think
it will still be incorrect.  One other observation: in a separate build
directory no Mac/Modules directory is created (though Mac/Python is).  This
is presumably where the Mac .o files belong.

Skip