From 764415abd0223245b510acbb64c2e3f5bb8c26b0 Mon Sep 17 00:00:00 2001 From: Etienne Laurin Date: Thu, 3 Oct 2013 02:56:04 +0000 Subject: [PATCH] protobuf: add native Python bindings Closes Homebrew/homebrew#23013. Signed-off-by: Adam Vandenberg --- Formula/protobuf.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Formula/protobuf.rb b/Formula/protobuf.rb index ac64361f8f473..c93dd1d3f3030 100644 --- a/Formula/protobuf.rb +++ b/Formula/protobuf.rb @@ -7,6 +7,8 @@ class Protobuf < Formula option :universal + depends_on :python => :optional + fails_with :llvm do build 2334 end @@ -25,11 +27,25 @@ def install # Install editor support and examples doc.install %w( editors examples ) + + if build.with? 'python' + python do + chdir 'python' do + ENV['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp' + ENV.append_to_cflags "-I#{include}" + ENV.append_to_cflags "-L#{lib}" + system python, 'setup.py', 'build' + system python, 'setup.py', 'install', "--prefix=#{prefix}", + '--single-version-externally-managed', '--record=installed.txt' + end + end + end end def caveats; <<-EOS.undent Editor support and examples have been installed to: #{doc} + #{python.standard_caveats if build.with? 'python'} EOS end end