Skip to content

Make Python 2 an optional dependency for Bazel build#24407

Merged
gnossen merged 3 commits intogrpc:masterfrom
gnossen:bazel_no_python2_required
Oct 16, 2020
Merged

Make Python 2 an optional dependency for Bazel build#24407
gnossen merged 3 commits intogrpc:masterfrom
gnossen:bazel_no_python2_required

Conversation

@gnossen
Copy link
Copy Markdown
Contributor

@gnossen gnossen commented Oct 13, 2020

This PR makes a Python 2 runtime with headers an optional dependency for Bazel builds. In case no proper Python 2 environment is detected, we create a rule like

filegroup(
  name="_python2_include",
  srcs=[],
)

This empty filegroup rule passes the analysis phase, but will fail during the build phase of any Python 2 targets, which are all test targets within our repo, and which downstream repos will not be touching.

This will also be backported to 1.33.

@gnossen gnossen added infra/Bazel kind/enhancement lang/Python release notes: yes Indicates if PR needs to be in release notes labels Oct 15, 2020
@gnossen gnossen changed the title Make Python2 an optional dependency for Bazel build Make Python 2 an optional dependency for Bazel build Oct 15, 2020
@gnossen gnossen requested a review from lidizheng October 15, 2020 21:32
@gnossen gnossen marked this pull request as ready for review October 15, 2020 21:32
Copy link
Copy Markdown
Contributor

@lidizheng lidizheng left a comment

Choose a reason for hiding this comment

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

LGTM! Are users asking for this feature?

@gnossen
Copy link
Copy Markdown
Contributor Author

gnossen commented Oct 15, 2020

Yes, the users I mentioned this morning were having trouble getting Python 2 installed in build environments that otherwise didn't need it.

@gnossen
Copy link
Copy Markdown
Contributor Author

gnossen commented Oct 16, 2020

Known failures:

  • Pip connection error
  • Network error downloading Python 3.8

We should probably add some retries in there.

@ChrisCummins
Copy link
Copy Markdown

Hi, did this land in v1.34.0? I am still getting python_configure errors building in an ubuntu:18.04 docker image using bazel. The workaround is to install python-dev.

Cheers,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants