Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 62dd873

Browse filesBrowse files
committed
1 parent 9d68f24 commit 62dd873
Copy full SHA for 62dd873

File tree

Expand file treeCollapse file tree

1 file changed

+14
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-1
lines changed

‎python/whl.bzl

Copy file name to clipboardExpand all lines: python/whl.bzl
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@
1313
# limitations under the License.
1414
"""Import .whl files into Bazel."""
1515

16+
def _find_python(repository_ctx):
17+
if "BAZEL_PYTHON" in repository_ctx.os.environ:
18+
return repository_ctx.os.environ.get("BAZEL_PYTHON")
19+
20+
python_path = repository_ctx.which("python")
21+
if not python_path:
22+
python_path = repository_ctx.which("python.exe")
23+
if python_path:
24+
return python_path
25+
26+
fail("rules_python requires a python interpreter installed. " +
27+
"Please set BAZEL_PYTHON, or put it on your path.")
28+
1629
def _whl_impl(repository_ctx):
1730
"""Core implementation of whl_library."""
1831

1932
args = [
20-
"python",
33+
_find_python(repository_ctx),
2134
repository_ctx.path(repository_ctx.attr._script),
2235
"--whl",
2336
repository_ctx.path(repository_ctx.attr.whl),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.