Skip to content

Commit 08c2fc9

Browse files
committed
Fix Bazel PEP 517 build environment isolation bug
1 parent f213412 commit 08c2fc9

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

setup.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,21 @@ def run(self):
9090
bazel_version = f.read().strip()
9191
os.environ["USE_BAZEL_VERSION"] = bazel_version
9292

93+
bazel_args = [
94+
self._bazel_cmd,
95+
"run",
96+
"-c",
97+
"opt",
98+
f"--repo_env=PYTHON_BIN_PATH={sys.executable}",
99+
]
100+
if "PYTHONPATH" in os.environ:
101+
bazel_args.append(f"--repo_env=PYTHONPATH={os.environ['PYTHONPATH']}")
102+
103+
bazel_args.extend(self._additional_build_options)
104+
bazel_args.append("//tensorflow_data_validation:move_generated_files")
105+
93106
subprocess.check_call(
94-
[self._bazel_cmd, "run", "-c", "opt"]
95-
+ self._additional_build_options
96-
+ ["//tensorflow_data_validation:move_generated_files"],
107+
bazel_args,
97108
# Bazel should be invoked in a directory containing bazel WORKSPACE
98109
# file, which is the root directory.
99110
cwd=os.path.dirname(os.path.realpath(__file__)),

0 commit comments

Comments
 (0)