From 3f3a7b1b06ed57b705ee8836fb4ad1d882648db8 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Wed, 11 Dec 2013 01:04:24 -0800 Subject: [PATCH] setup.py: user specified paths and prefix should come before platform --- setup.py | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/setup.py b/setup.py index 4d3dfa270..ac7910a9a 100644 --- a/setup.py +++ b/setup.py @@ -156,6 +156,30 @@ class pil_build_ext(build_ext): _add_directory(library_dirs, lib_root) _add_directory(include_dirs, include_root) + # respect CFLAGS/LDFLAGS + for k in ('CFLAGS', 'LDFLAGS'): + if k in os.environ: + for match in re.finditer(r'-I([^\s]+)', os.environ[k]): + _add_directory(include_dirs, match.group(1)) + for match in re.finditer(r'-L([^\s]+)', os.environ[k]): + _add_directory(library_dirs, match.group(1)) + + # include, rpath, if set as environment variables: + for k in ('C_INCLUDE_PATH', 'CPATH', 'INCLUDE'): + if k in os.environ: + for d in os.environ[k].split(os.path.pathsep): + _add_directory(include_dirs, d) + + for k in ('LD_RUN_PATH', 'LIBRARY_PATH', 'LIB'): + if k in os.environ: + for d in os.environ[k].split(os.path.pathsep): + _add_directory(library_dirs, d) + + prefix = sysconfig.get_config_var("prefix") + if prefix: + _add_directory(library_dirs, os.path.join(prefix, "lib")) + _add_directory(include_dirs, os.path.join(prefix, "include")) + # # add platform directories @@ -217,30 +241,6 @@ class pil_build_ext(build_ext): # FIXME: check /opt/stuff directories here? - # respect CFLAGS/LDFLAGS - for k in ('CFLAGS', 'LDFLAGS'): - if k in os.environ: - for match in re.finditer(r'-I([^\s]+)', os.environ[k]): - _add_directory(include_dirs, match.group(1)) - for match in re.finditer(r'-L([^\s]+)', os.environ[k]): - _add_directory(library_dirs, match.group(1)) - - # include, rpath, if set as environment variables: - for k in ('C_INCLUDE_PATH', 'CPATH', 'INCLUDE'): - if k in os.environ: - for d in os.environ[k].split(os.path.pathsep): - _add_directory(include_dirs, d) - - for k in ('LD_RUN_PATH', 'LIBRARY_PATH', 'LIB'): - if k in os.environ: - for d in os.environ[k].split(os.path.pathsep): - _add_directory(library_dirs, d) - - prefix = sysconfig.get_config_var("prefix") - if prefix: - _add_directory(library_dirs, os.path.join(prefix, "lib")) - _add_directory(include_dirs, os.path.join(prefix, "include")) - # # locate tkinter libraries