Handle polymorphic types for lib_root and include_root in setup.py

Depending on whether these are created by pkg_config or not they might
be a list of directories or just a string with a single directory.
This commit is contained in:
adisbladis 2023-04-05 15:26:46 +12:00
parent 943a7a89c5
commit d94239ae3d

View File

@ -473,11 +473,17 @@ class pil_build_ext(build_ext):
lib_root = include_root = root
if lib_root is not None:
for lib_dir in lib_root:
_add_directory(library_dirs, lib_dir)
if isinstance(lib_root, str):
_add_directory(library_dirs, lib_root)
else:
for lib_dir in lib_root:
_add_directory(library_dirs, lib_dir)
if include_root is not None:
for include_dir in include_root:
_add_directory(include_dirs, include_dir)
if isinstance(include_root, str):
_add_directory(include_dirs, include_root)
else:
for include_dir in include_root:
_add_directory(include_dirs, include_dir)
# respect CFLAGS/CPPFLAGS/LDFLAGS
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"):