mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-26 16:50:33 +03:00
Merge pull request #3395 from diorcety/improve_configuration
Improve configuration
This commit is contained in:
commit
c2b3bd5635
18
setup.py
18
setup.py
|
@ -147,15 +147,20 @@ LCMS_ROOT = None
|
|||
|
||||
def _pkg_config(name):
|
||||
try:
|
||||
command = [
|
||||
command_libs = [
|
||||
'pkg-config',
|
||||
'--libs-only-L', name,
|
||||
]
|
||||
command_cflags = [
|
||||
'pkg-config',
|
||||
'--cflags-only-I', name,
|
||||
]
|
||||
if not DEBUG:
|
||||
command.append('--silence-errors')
|
||||
libs = subprocess.check_output(command).decode('utf8').split(' ')
|
||||
return libs[1][2:].strip(), libs[0][2:].strip()
|
||||
command_libs.append('--silence-errors')
|
||||
command_cflags.append('--silence-errors')
|
||||
libs = subprocess.check_output(command_libs).decode('utf8').strip().replace('-L', '')
|
||||
cflags = subprocess.check_output(command_cflags).decode('utf8').strip().replace('-I', '')
|
||||
return (libs, cflags)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
@ -247,6 +252,11 @@ class pil_build_ext(build_ext):
|
|||
IMAGEQUANT_ROOT="libimagequant"
|
||||
).items():
|
||||
root = globals()[root_name]
|
||||
|
||||
if root is None and root_name in os.environ:
|
||||
prefix = os.environ[root_name]
|
||||
root = (os.path.join(prefix, 'lib'), os.path.join(prefix, 'include'))
|
||||
|
||||
if root is None and pkg_config:
|
||||
if isinstance(lib_name, tuple):
|
||||
for lib_name2 in lib_name:
|
||||
|
|
Loading…
Reference in New Issue
Block a user