Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle more than one directory returned by pkg-config #6896

Merged
merged 2 commits into from
Jan 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 15 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,18 @@ 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", "")
)
cflags = (
subprocess.check_output(command_cflags)
.strip(),
)[::2][1:]
cflags = re.split(
r"(^|\s+)-I",
subprocess.check_output(command_cflags, stderr=stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to briefly explain why you added , stderr=stderr here? It was added to the libs command in #6261 to avoid a Unknown option --keep-system-libs error, but that doesn't apply to the cflags command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the other check_output call, since only STDOUT is used to get the paths.

Copy link
Member

@radarhere radarhere Apr 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion, this was later reverted in #7046

.decode("utf8")
.strip()
.replace("-I", "")
)
.strip(),
)[::2][1:]
return libs, cflags
except Exception:
pass
Expand Down Expand Up @@ -473,8 +473,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