From d94239ae3d21d8ae03f5120228dc8225faa99bac Mon Sep 17 00:00:00 2001 From: adisbladis Date: Wed, 5 Apr 2023 15:26:46 +1200 Subject: [PATCH] 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. --- setup.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 07d6c66d655..d780b038ade 100755 --- a/setup.py +++ b/setup.py @@ -473,11 +473,17 @@ def build_extensions(self): 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"):