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 fb84199

Browse filesBrowse files
committed
use CPPFLAGS for ubiquity
1 parent de30201 commit fb84199
Copy full SHA for fb84199

File tree

1 file changed

+5
-4
lines changed
Filter options

1 file changed

+5
-4
lines changed

‎python/pip_install/pip_repository.bzl

Copy file name to clipboardExpand all lines: python/pip_install/pip_repository.bzl
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load("//python:repositories.bzl", "STANDALONE_INTERPRETER_FILENAME")
44
load("//python/pip_install:repositories.bzl", "all_requirements")
55
load("//python/pip_install/private:srcs.bzl", "PIP_INSTALL_PY_SRCS")
66

7-
CFLAGS = "CFLAGS"
7+
CPPFLAGS = "CPPFLAGS"
88

99
def _construct_pypath(rctx):
1010
"""Helper function to construct a PYTHONPATH.
@@ -65,7 +65,7 @@ def _resolve_python_interpreter(rctx):
6565
return python_interpreter
6666

6767
def _maybe_set_xcode_location_cflags(rctx, environment):
68-
"""Patch environment with CFLAGS of xcode sdk location.
68+
"""Patch environment with CPPFLAGS of xcode sdk location.
6969
7070
Figure out if this interpreter target comes from rules_python, and patch the xcode sdk location if so.
7171
Pip won't be able to compile c extensions from sdists with the pre built python distributions from indygreg
@@ -74,7 +74,8 @@ def _maybe_set_xcode_location_cflags(rctx, environment):
7474
if (
7575
rctx.os.name.lower().startswith("mac os") and
7676
rctx.attr.python_interpreter_target != None and
77-
rctx.path(Label("@{}//:{}".format(rctx.attr.python_interpreter_target.workspace_name, STANDALONE_INTERPRETER_FILENAME)))
77+
rctx.path(Label("@{}//:{}".format(rctx.attr.python_interpreter_target.workspace_name, STANDALONE_INTERPRETER_FILENAME))) and
78+
not environment.get(CPPFLAGS)
7879
):
7980
xcode_sdk_location = rctx.execute(["xcode-select", "-p"])
8081
if xcode_sdk_location.return_code == 0:
@@ -83,7 +84,7 @@ def _maybe_set_xcode_location_cflags(rctx, environment):
8384
# This is a full xcode installation somewhere like /Applications/Xcode13.0.app/Contents/Developer
8485
# so we need to change the path to to the macos specific tools.
8586
xcode_root = "{}/Platforms/MacOSX.platform/Developer".format(xcode_root)
86-
environment[CFLAGS] = "-isysroot {}/SDKs/MacOSX.sdk".format(xcode_root)
87+
environment[CPPFLAGS] = "-isysroot {}/SDKs/MacOSX.sdk".format(xcode_root)
8788

8889
def _parse_optional_attrs(rctx, args):
8990
"""Helper function to parse common attributes of pip_repository and whl_library repository rules.

0 commit comments

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