mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +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):
|
def _pkg_config(name):
|
||||||
try:
|
try:
|
||||||
command = [
|
command_libs = [
|
||||||
'pkg-config',
|
'pkg-config',
|
||||||
'--libs-only-L', name,
|
'--libs-only-L', name,
|
||||||
|
]
|
||||||
|
command_cflags = [
|
||||||
|
'pkg-config',
|
||||||
'--cflags-only-I', name,
|
'--cflags-only-I', name,
|
||||||
]
|
]
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
command.append('--silence-errors')
|
command_libs.append('--silence-errors')
|
||||||
libs = subprocess.check_output(command).decode('utf8').split(' ')
|
command_cflags.append('--silence-errors')
|
||||||
return libs[1][2:].strip(), libs[0][2:].strip()
|
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:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -247,6 +252,11 @@ class pil_build_ext(build_ext):
|
||||||
IMAGEQUANT_ROOT="libimagequant"
|
IMAGEQUANT_ROOT="libimagequant"
|
||||||
).items():
|
).items():
|
||||||
root = globals()[root_name]
|
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 root is None and pkg_config:
|
||||||
if isinstance(lib_name, tuple):
|
if isinstance(lib_name, tuple):
|
||||||
for lib_name2 in lib_name:
|
for lib_name2 in lib_name:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user