diff options
| author | Pete Gadomski | 2014-02-28 09:49:38 -0700 |
|---|---|---|
| committer | Mike McQuaid | 2014-03-05 09:37:10 +0000 |
| commit | 0c5da90372854bbfb46ea7aacb56add365cee5c7 (patch) | |
| tree | b718ec602c17edd683795776ffad676008007d05 /Library/Formula | |
| parent | 735cd28276933d35b8f8663c08cc945d07b45817 (diff) | |
| download | homebrew-0c5da90372854bbfb46ea7aacb56add365cee5c7.tar.bz2 | |
ledger: find Homebrew Python when building --HEAD.
When building --HEAD and --with-python, CMake gets confused by multiple
python installations, e.g. when both Homebrew and system Pythons exist
(see https://github.com/Homebrew/homebrew/issues/10393 for one example).
This patch lifts some hacks from
https://github.com/Homebrew/homebrew/blob/51d054c/Library/Formula/opencv.rb
to point CMake to the Homebrew Python only, if one exists and is
installed.
N.B. brew test ledger seems to be broken when installed --HEAD for
unrelated reasons.
Closes #27095.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/ledger.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Library/Formula/ledger.rb b/Library/Formula/ledger.rb index 9ac2145d0..cb96ae7b8 100644 --- a/Library/Formula/ledger.rb +++ b/Library/Formula/ledger.rb @@ -34,7 +34,19 @@ class Ledger < Formula # Support homebrew not at /usr/local. Also support Xcode-only setups: inreplace 'acprep', 'search_prefixes = [', "search_prefixes = ['#{HOMEBREW_PREFIX}','#{MacOS.sdk_path}/usr'," args = [((build.include? 'debug') ? 'debug' : 'opt'), "make", "install", "-N", "-j#{ENV.make_jobs}", "--output=build"] - args << '--python' if build.with? 'python' + + if build.with? 'python' + # Per #25118, CMake does a poor job of detecting a brewed Python. + # We need to tell CMake explicitly where our default python lives. + # Inspired by + # https://github.com/Homebrew/homebrew/blob/51d054c/Library/Formula/opencv.rb + args << '--python' << '--' + + python_prefix = `python-config --prefix`.strip + args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'" + args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'" + end + system "./acprep", "--prefix=#{prefix}", *args (share+'ledger').install 'python/demo.py', 'test/input/sample.dat', Dir['contrib'] else |
