Source

pygame / config_darwin.py

Diff from to

config_darwin.py

 from distutils.sysconfig import get_python_inc
 from config_unix import DependencyProg
 
+
+try:
+    basestring_ = basestring
+except NameError:
+    #python 3.
+    basestring_ = str
+
 class Dependency:
     libext = '.dylib'
     def __init__(self, name, checkhead, checklib, libs):
         self.cflags = ''
 
     def configure(self, incdirs, libdirs):
-        incname = self.checkhead
+        incnames = self.checkhead
         libnames = self.checklib, self.name.lower()
         for dir in incdirs:
-            path = os.path.join(dir, incname)
-            if os.path.isfile(path):
-                self.inc_dir = dir
-                break
+            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
+
         for dir in libdirs:
             for name in libnames:
                 path = os.path.join(dir, name)
 DEPS = [
     [DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']),
          FrameworkDependency('SDL', 'SDL.h', 'libSDL', 'SDL')],
-    [Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', ['SDL_ttf']),
+    [Dependency('FONT', ['SDL_ttf.h', 'SDL/SDL_ttf.h'], 'libSDL_ttf', ['SDL_ttf']),
          FrameworkDependency('FONT', 'SDL_ttf.h', 'libSDL_ttf', 'SDL_ttf')],     
-    [Dependency('IMAGE', 'SDL_image.h', 'libSDL_image', ['SDL_image']),
+    [Dependency('IMAGE', ['SDL_image.h', 'SDL/SDL_image.h'], 'libSDL_image', ['SDL_image']),
          FrameworkDependency('IMAGE', 'SDL_image.h', 'libSDL_image', 'SDL_image')],
-    [Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer', ['SDL_mixer']),
+    [Dependency('MIXER', ['SDL_mixer.h', 'SDL/SDL_mixer.h'], 'libSDL_mixer', ['SDL_mixer']),
          FrameworkDependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer', 'SDL_mixer')],
     [DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', ['smpeg']),
          FrameworkDependency('SMPEG', 'smpeg.h', 'libsmpeg', 'smpeg')],
-    FrameworkDependency('PORTTIME', 'CoreMidi.h', 'CoreMidi', 'CoreMidi'),
+    FrameworkDependency('PORTTIME', 'CoreMidi.h', 'CoreMidi', 'CoreMIDI'),
     FrameworkDependency('QUICKTIME', 'QuickTime.h', 'QuickTime', 'QuickTime'),
     Dependency('PNG', 'png.h', 'libpng', ['png']),
     Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']),
     libdirs = ['/usr/local/lib', '/usr/X11/lib', '/opt/local/lib']
 
     for d in DEPS:
+        if isinstance(d, (list, tuple)):
+            for deptype in d:
+                deptype.configure(incdirs, libdirs)
+        else:
+            d.configure(incdirs, libdirs)
+
+    for d in DEPS:
         if type(d)==list:
             found = False
             for deptype in d:
             if not found:
                 DEPS[DEPS.index(d)] = d[0]
     
-    for d in DEPS:
-        d.configure(incdirs, libdirs)
     DEPS[0].cflags = '-Ddarwin '+ DEPS[0].cflags
     return DEPS
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.