Merge pull request #3395 from diorcety/improve_configuration

Improve configuration
This commit is contained in:
Hugo 2018-12-26 13:54:16 +02:00 committed by GitHub
commit c2b3bd5635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: