From 7104f73f4bfeb42b56564f0dd34fa4ff331a6126 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Fri, 5 Apr 2024 20:43:35 -0400 Subject: [PATCH] protobuf@21: use `pip` Signed-off-by: Michael Cho --- Formula/p/protobuf@21.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Formula/p/protobuf@21.rb b/Formula/p/protobuf@21.rb index bacde576afc39..38ecbca6747a9 100644 --- a/Formula/p/protobuf@21.rb +++ b/Formula/p/protobuf@21.rb @@ -19,16 +19,10 @@ class ProtobufAT21 < Formula keg_only :versioned_formula depends_on "cmake" => :build - depends_on "python-setuptools" => :build depends_on "python@3.11" => [:build, :test] depends_on "python@3.12" => [:build, :test] - uses_from_macos "zlib" - def pythons - deps.map(&:to_formula) - .select { |f| f.name.match?(/^python@\d\.\d+$/) } - .map { |f| f.opt_libexec/"bin/python" } - end + uses_from_macos "zlib" # Fix build with python@3.11 patch do @@ -36,6 +30,12 @@ def pythons sha256 "911925e427a396fa5e54354db8324c0178f5c602b3f819f7d471bb569cc34f53" end + def pythons + deps.map(&:to_formula) + .select { |f| f.name.match?(/^python@\d\.\d+$/) } + .map { |f| f.opt_libexec/"bin/python" } + end + def install cmake_args = %w[ -Dprotobuf_BUILD_LIBPROTOC=ON @@ -57,12 +57,12 @@ def install ENV.append_to_cflags "-L#{lib}" ENV["PROTOC"] = bin/"protoc" - cd "python" do - pythons.each do |python| - pyext_dir = prefix/Language::Python.site_packages(python)/"google/protobuf/pyext" - with_env(LDFLAGS: "-Wl,-rpath,#{rpath(source: pyext_dir)} #{ENV.ldflags}".strip) do - system python, *Language::Python.setup_install_args(prefix, python), "--cpp_implementation" - end + pip_args = ["--config-settings=--build-option=--cpp_implementation"] + pythons.each do |python| + build_isolation = Language::Python.major_minor_version(python) >= "3.12" + pyext_dir = prefix/Language::Python.site_packages(python)/"google/protobuf/pyext" + with_env(LDFLAGS: "-Wl,-rpath,#{rpath(source: pyext_dir)} #{ENV.ldflags}".strip) do + system python, "-m", "pip", "install", *pip_args, *std_pip_args(build_isolation:), "./python" end end