Skip to content

Commit

Permalink
Handle more than one directory returned by pkg-config.
Browse files Browse the repository at this point in the history
tiff (4.5.0-1) in Debian results in two include directories being returned:
```
-I/usr/include/x86_64-linux-gnu -I/usr/include
```
  • Loading branch information
sebastic committed Jan 15, 2023
1 parent 43bb035 commit 04cf5e2
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,20 @@ def _pkg_config(name):
if not DEBUG:
command_libs.append("--silence-errors")
command_cflags.append("--silence-errors")
libs = (
libs = re.split(
r"\s*-L",
subprocess.check_output(command_libs, stderr=stderr)
.decode("utf8")
.strip()
.replace("-L", "")
.strip(),
)
cflags = (
subprocess.check_output(command_cflags)
libs.remove("")
cflags = re.split(
r"\s*-I",
subprocess.check_output(command_cflags, stderr=stderr)
.decode("utf8")
.strip()
.replace("-I", "")
.strip(),
)
cflags.remove("")
return libs, cflags
except Exception:
pass
Expand Down Expand Up @@ -473,8 +475,12 @@ def build_extensions(self):
else:
lib_root = include_root = root

_add_directory(library_dirs, lib_root)
_add_directory(include_dirs, include_root)
if lib_root is not None:
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)

# respect CFLAGS/CPPFLAGS/LDFLAGS
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"):
Expand Down

0 comments on commit 04cf5e2

Please sign in to comment.