Skip to content

Commit 636f55c

Browse files
authored
Guard python_interpreter_target workspace name on None type check. (#755)
1 parent df308be commit 636f55c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

python/pip_install/pip_repository.bzl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,17 @@ def _maybe_set_xcode_location_cflags(rctx, environment):
7373
Pip won't be able to compile c extensions from sdists with the pre built python distributions from indygreg
7474
otherwise. See https://github.com/indygreg/python-build-standalone/issues/103
7575
"""
76-
python_interpreter_workspace = rctx.path(Label("@{}//:WORKSPACE".format(rctx.attr.python_interpreter_target.workspace_name))).dirname
7776
if (
7877
rctx.os.name.lower().startswith("mac os") and
7978
rctx.attr.python_interpreter_target != None and
8079
# This is a rules_python provided toolchain.
81-
rctx.execute(["ls", "{}/{}".format(python_interpreter_workspace, STANDALONE_INTERPRETER_FILENAME)]).return_code == 0 and
80+
rctx.execute([
81+
"ls",
82+
"{}/{}".format(
83+
rctx.path(Label("@{}//:WORKSPACE".format(rctx.attr.python_interpreter_target.workspace_name))).dirname,
84+
STANDALONE_INTERPRETER_FILENAME,
85+
),
86+
]).return_code == 0 and
8287
not environment.get(CPPFLAGS)
8388
):
8489
xcode_sdk_location = rctx.execute(["xcode-select", "--print-path"])

0 commit comments

Comments
 (0)