mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Merge pull request #442 from ohanar/path_fixes
Include and library path fixes
This commit is contained in:
commit
289198b220
56
setup.py
56
setup.py
|
@ -37,7 +37,10 @@ _LIB_IMAGING = (
|
||||||
|
|
||||||
|
|
||||||
def _add_directory(path, dir, where=None):
|
def _add_directory(path, dir, where=None):
|
||||||
if dir and os.path.isdir(dir) and dir not in path:
|
if dir is None:
|
||||||
|
return
|
||||||
|
dir = os.path.realpath(dir)
|
||||||
|
if os.path.isdir(dir) and dir not in path:
|
||||||
if where is None:
|
if where is None:
|
||||||
path.append(dir)
|
path.append(dir)
|
||||||
else:
|
else:
|
||||||
|
@ -156,6 +159,30 @@ class pil_build_ext(build_ext):
|
||||||
_add_directory(library_dirs, lib_root)
|
_add_directory(library_dirs, lib_root)
|
||||||
_add_directory(include_dirs, include_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
|
# add platform directories
|
||||||
|
|
||||||
|
@ -187,7 +214,7 @@ class pil_build_ext(build_ext):
|
||||||
_add_directory(include_dirs, os.path.join(prefix, 'include'))
|
_add_directory(include_dirs, os.path.join(prefix, 'include'))
|
||||||
except:
|
except:
|
||||||
pass # homebrew not installed
|
pass # homebrew not installed
|
||||||
|
|
||||||
elif sys.platform.startswith("linux"):
|
elif sys.platform.startswith("linux"):
|
||||||
for platform_ in (plat.processor(), plat.architecture()[0]):
|
for platform_ in (plat.processor(), plat.architecture()[0]):
|
||||||
|
|
||||||
|
@ -215,33 +242,8 @@ class pil_build_ext(build_ext):
|
||||||
_add_directory(library_dirs, "/usr/pkg/lib")
|
_add_directory(library_dirs, "/usr/pkg/lib")
|
||||||
_add_directory(include_dirs, "/usr/pkg/include")
|
_add_directory(include_dirs, "/usr/pkg/include")
|
||||||
|
|
||||||
_add_directory(library_dirs, "/usr/local/lib")
|
|
||||||
# FIXME: check /opt/stuff directories here?
|
# 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', '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
|
# locate tkinter libraries
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user