From 15cd8eda095d20856b70325c636f6c8950afd1b7 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sun, 30 Jun 2019 21:52:58 +0100 Subject: [PATCH] Respect the PKG_CONFIG environment variable when building This variable is commonly used by other build systems and using it can help with cross-compiling. Falls back to "pkg-config" as before. --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2c25543a9..5ceae3443 100755 --- a/setup.py +++ b/setup.py @@ -242,8 +242,9 @@ LCMS_ROOT = None def _pkg_config(name): try: - command_libs = ["pkg-config", "--libs-only-L", name] - command_cflags = ["pkg-config", "--cflags-only-I", name] + command = os.environ.get("PKG_CONFIG", "pkg-config") + command_libs = [command, "--libs-only-L", name] + command_cflags = [command, "--cflags-only-I", name] if not DEBUG: command_libs.append("--silence-errors") command_cflags.append("--silence-errors") @@ -347,7 +348,7 @@ class pil_build_ext(build_ext): _add_directory(include_dirs, "src/libImaging") pkg_config = None - if _cmd_exists("pkg-config"): + if _cmd_exists(os.environ.get("PKG_CONFIG", "pkg-config")): pkg_config = _pkg_config #