Skip to content

Commit

Permalink
Refactor tf_wheel build rule: return wheel file instead of wheel cont…
Browse files Browse the repository at this point in the history
…aining folder.

This change will enable future Bazel tests that use wheel build rule.

PiperOrigin-RevId: 689003106
  • Loading branch information
tensorflower-gardener authored and copybara-github committed Oct 23, 2024
1 parent 0e3f52d commit a66273e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion third_party/py/python_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def _python_repository_impl(ctx):
ctx.file("BUILD", "")
wheel_name = ctx.os.environ.get("WHEEL_NAME", "tensorflow")
wheel_collab = ctx.os.environ.get("WHEEL_COLLAB", False)
macos_deployment_target = ctx.os.environ.get("MACOSX_DEPLOYMENT_TARGET", "")

requirements = None
for i in range(0, len(ctx.attr.requirements_locks)):
Expand Down Expand Up @@ -58,7 +59,7 @@ Please check python_init_repositories() in your WORKSPACE file.
)

if use_pywrap_rules:
print("!!!Using pywrap rules instead of directly creating .so objects!!!")
print("!!!Using pywrap rules instead of directly creating .so objects!!!") # buildifier: disable=print

ctx.file(
"py_version.bzl",
Expand All @@ -70,13 +71,15 @@ WHEEL_COLLAB = "{wheel_collab}"
REQUIREMENTS = "{requirements}"
REQUIREMENTS_WITH_LOCAL_WHEELS = "{requirements_with_local_wheels}"
USE_PYWRAP_RULES = {use_pywrap_rules}
MACOSX_DEPLOYMENT_TARGET = "{macos_deployment_target}"
""".format(
version = version,
wheel_name = wheel_name,
wheel_collab = wheel_collab,
requirements = str(requirements),
requirements_with_local_wheels = requirements_with_local_wheels,
use_pywrap_rules = use_pywrap_rules,
macos_deployment_target = macos_deployment_target,
),
)

Expand Down

0 comments on commit a66273e

Please sign in to comment.