mediapipe/third_party/tensorflow_065c20bf79253257c87bd4614bb9a7fdef015cbb.diff
MediaPipe Team 294687295d Project import generated by Copybara.
PiperOrigin-RevId: 263889205
2019-08-16 18:56:48 -07:00

23 lines
1.2 KiB
Diff

commit 065c20bf79253257c87bd4614bb9a7fdef015cbb
Author: Camillo Lugaresi <camillol@google.com>
Date: Thu Aug 15 18:34:41 2019 -0700
Use python3 if available to run gen_git_source.py.
gen_git_source.py fails with an "ImportError: No module named builtins" on a default installation of Python 2 (at least, the one that comes with macOS). This can be worked around by installing the "future" package from pip. However, instead of requiring users to go through this extra step, we can simply run the script using Python 3 if it's installed. The script works on a default installation of Python 3, without requiring extra packages.
diff --git a/third_party/git/git_configure.bzl b/third_party/git/git_configure.bzl
index fc18fdb988..3ce64242af 100644
--- a/third_party/git/git_configure.bzl
+++ b/third_party/git/git_configure.bzl
@@ -18,6 +18,9 @@ def _get_python_bin(repository_ctx):
python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH)
if python_bin != None:
return python_bin
+ python_bin_path = repository_ctx.which("python3")
+ if python_bin_path != None:
+ return str(python_bin_path)
python_bin_path = repository_ctx.which("python")
if python_bin_path != None:
return str(python_bin_path)