From 78e742da8a53ffe6995ea0c01dcccf974a20b5fe Mon Sep 17 00:00:00 2001 From: ryenus Date: Mon, 26 Dec 2022 14:52:36 +0800 Subject: [PATCH] libtensorflow: rebuild * libtensorflow: migrate to python@3.11 * libtensorflow: add python libexec to PATH Closes #119032. Co-authored-by: Michael Cho Signed-off-by: Rui Chen Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> --- Formula/libtensorflow.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Formula/libtensorflow.rb b/Formula/libtensorflow.rb index 88d79cf285b..ac6e9699756 100644 --- a/Formula/libtensorflow.rb +++ b/Formula/libtensorflow.rb @@ -18,7 +18,7 @@ class Libtensorflow < Formula depends_on "bazelisk" => :build depends_on "numpy" => :build - depends_on "python@3.10" => :build + depends_on "python@3.11" => :build resource "homebrew-test-model" do url "https://github.com/tensorflow/models/raw/v1.13.0/samples/languages/java/training/model/graph.pb" @@ -26,6 +26,7 @@ class Libtensorflow < Formula end def install + python3 = "python3.11" optflag = if Hardware::CPU.arm? && OS.mac? "-mcpu=apple-m1" elsif build.bottle? @@ -34,7 +35,7 @@ class Libtensorflow < Formula "-march=native" end ENV["CC_OPT_FLAGS"] = optflag - ENV["PYTHON_BIN_PATH"] = which("python3.10") + ENV["PYTHON_BIN_PATH"] = which(python3) ENV["TF_IGNORE_MAX_BAZEL_VERSION"] = "1" ENV["TF_NEED_JEMALLOC"] = "1" ENV["TF_NEED_GCP"] = "0" @@ -64,7 +65,8 @@ class Libtensorflow < Formula --verbose_failures ] if OS.linux? - env_path = "#{HOMEBREW_PREFIX}/bin:/usr/bin:/bin" + pyver = Language::Python.major_minor_version python3 + env_path = "#{Formula["python@#{pyver}"].opt_libexec}/bin:#{HOMEBREW_PREFIX}/bin:/usr/bin:/bin" bazel_args += %W[ --action_env=PATH=#{env_path} --host_action_env=PATH=#{env_path}