From ee039a3b8d36aee220367300dd1892781ae97e1b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 15 Oct 2021 17:42:19 +0800 Subject: [PATCH] protobuf: build python bindings for 3.10 too We're migrating a number of protobuf dependents on Python 3.10 in #87277. We could migrate protobuf fully to Python 3.10 there too, but I'd like to avoid pulling in protobuf's dependency tree into the CI run there. --- Formula/protobuf.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Formula/protobuf.rb b/Formula/protobuf.rb index b0b7d5ba603c7..2ab324cad3204 100644 --- a/Formula/protobuf.rb +++ b/Formula/protobuf.rb @@ -4,6 +4,7 @@ class Protobuf < Formula url "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz" sha256 "77ad26d3f65222fd96ccc18b055632b0bfedf295cb748b712a98ba1ac0b704b2" license "BSD-3-Clause" + revision 1 livecheck do url :stable @@ -28,6 +29,8 @@ class Protobuf < Formula depends_on "libtool" => :build end + depends_on "python@3.10" => [:build, :test] + # The Python3.9 bindings can be removed when Python3.9 is made keg-only. depends_on "python@3.9" => [:build, :test] depends_on "six" @@ -54,9 +57,10 @@ def install ENV.append_to_cflags "-I#{include}" ENV.append_to_cflags "-L#{lib}" - chdir "python" do - system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(prefix), - "--cpp_implementation" + cd "python" do + ["3.9", "3.10"].each do |xy| + system "python#{xy}", *Language::Python.setup_install_args(prefix), "--cpp_implementation" + end end end @@ -74,5 +78,6 @@ def install (testpath/"test.proto").write testdata system bin/"protoc", "test.proto", "--cpp_out=." system Formula["python@3.9"].opt_bin/"python3", "-c", "import google.protobuf" + system Formula["python@3.10"].opt_bin/"python3", "-c", "import google.protobuf" end end