Permalink
Browse files

Use freetype-config if pkg-config is not installed

  • Loading branch information...
1 parent bd241b5 commit 090effa56ca59d20301ebcc705d074687f603150 @mdboom committed Apr 24, 2013
Showing with 12 additions and 4 deletions.
  1. +12 −4 setupext.py
View
@@ -270,16 +270,23 @@ def set_pkgconfig_path(self):
os.environ['PKG_CONFIG_PATH'] = pkgconfig_path
def setup_extension(self, ext, package, default_include_dirs=[],
- default_library_dirs=[], default_libraries=[]):
+ default_library_dirs=[], default_libraries=[],
+ alt_exec=None):
"""
Add parameters to the given `ext` for the given `package`.
"""
flag_map = {
'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
- command = "pkg-config --libs --cflags " + package
- use_defaults = True
+ executable = alt_exec
if self.has_pkgconfig:
+ executable = 'pkg-config {0}'.format(package)
+
+ use_defaults = True
+
+ if executable is not None:
+ command = "{0} --libs --cflags ".format(executable)
+
try:
output = check_output(command, shell=True)
except subprocess.CalledProcessError:
@@ -752,7 +759,8 @@ def add_flags(self, ext):
'lib/freetype2/include/freetype2'],
default_library_dirs=[
'freetype2/lib'],
- default_libraries=['freetype', 'z'])
+ default_libraries=['freetype', 'z'],
+ alt_exec='freetype-config')
class FT2Font(SetupPackage):

0 comments on commit 090effa

Please sign in to comment.