[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Mac OS X MIDI support success (MacPorts)



Am 03.03.12 17:36, schrieb René Dudfield:
you're right.  It picks the non framework build over the Framework build
if they are both there.  Without your patch, when there is nothing in
/usr/local, but there are Framework builds it does not work.

I think, that means I got it right, good. :)

I'm not sure why the extra header search needs to be there?  Can you
please explain why this is needed?

Because with MacPorts, the headers for SDL_image, SL_mixer, SDL_ttf etc. are installed under /opt/local/include/SDL (but SDL.h is installed directly under /opt/local/include). The PyGame sources use '#include <SDL_image.h' etc., so they wouldn't find them.

So I changed the check for the header files in Dependency.configure() to:

    for dir in incdirs:
        if isinstance(incnames, basestring):
            incnames = [incnames]
        for incname in incnames:
            path = os.path.join(dir, incname)

            if os.path.isfile(path):
                self.inc_dir = os.path.dirname(path)
                break

This allow to specify either a single header file or a list of header file locations with optional leading direcrtories (relative to one of the incdirs) and saves the directory of the found header in self.inc_dir, not the currently checked directory from incdirs. I could have just added '/opt/local/include/SDL' to the global incdirs, but with the changed code you can just specify extra include sub-directories for a single dependency. Still a bit of a kludge, but it works. :)

Chris