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

Fix python_direct_link target on Focal #13400

Merged
merged 1 commit into from
May 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tools/workspace/python/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,20 @@ def _impl(repository_ctx):

linkopts_direct_link = list(linkopts)

if py_info.os.is_macos:
# python3-config --libs from the [email protected] formula is missing the
# python3.8 library.
# TODO(jamiesnape): Check whether this is still the case when the
# python formula is upgraded to 3.8.
has_direct_link = False
libpy = "python" + py_info.version
for i in reversed(range(len(linkopts))):
if linkopts[i].startswith("-l") and linkopts[i].find(libpy) != -1:
has_direct_link = True
# python3.8-config --libs is missing the python3.8 library.
has_direct_link = False
libpy = "python" + py_info.version
for i in reversed(range(len(linkopts))):
if linkopts[i].startswith("-l") and linkopts[i].find(libpy) != -1:
has_direct_link = True
if py_info.os.is_macos:
linkopts.pop(i)

if py_info.os.is_macos:
linkopts = ["-undefined dynamic_lookup"] + linkopts
if not has_direct_link:
linkopts_direct_link = ["-l" + libpy] + linkopts_direct_link

if not has_direct_link:
linkopts_direct_link = ["-l" + libpy] + linkopts_direct_link

skylark_content = """
# DO NOT EDIT: generated by python_repository()
Expand Down