aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libplist.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula/libplist.rb')
-rw-r--r--Library/Formula/libplist.rb61
1 files changed, 11 insertions, 50 deletions
diff --git a/Library/Formula/libplist.rb b/Library/Formula/libplist.rb
index ea7ebe7ae..1ad821e33 100644
--- a/Library/Formula/libplist.rb
+++ b/Library/Formula/libplist.rb
@@ -7,15 +7,12 @@ class Libplist < Formula
head 'http://git.sukimashita.com/libplist.git'
+ # Improve the default option descr. generated by `depends_on :python => :optional`
option 'with-python', 'Enable Cython Python bindings'
depends_on 'cmake' => :build
-
- if build.include? 'with-python'
- depends_on 'Cython' => :python
- # Needed to find the Cython executable
- env :userpaths
- end
+ depends_on :python => :optional
+ depends_on 'Cython' => :python if build.with? 'python'
def install
ENV.deparallelize # make fails on an 8-core Mac Pro
@@ -25,39 +22,13 @@ class Libplist < Formula
# Disable Swig Python bindings
args << "-DENABLE_SWIG='OFF'"
- if build.include? 'with-python'
- ## Taken from opencv.rb
- #
- # The CMake `FindPythonLibs` Module is dumber than a bag of hammers when
- # more than one python installation is available---for example, it clings
- # to the Header folder of the system Python Framework like a drowning
- # sailor.
- #
- # This code was cribbed from the VTK formula and uses the output to
- # `python-config` to do the job FindPythonLibs should be doing in the first
- # place.
- python_prefix = `python-config --prefix`.strip
- # Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
- if File.exist? "#{python_prefix}/Python"
- # Python was compiled with --framework:
- args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
- if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library'
- # For Xcode-only systems, the headers of system's python are inside of Xcode
- args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'"
- else
- args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
- end
- else
- python_lib = "#{python_prefix}/lib/lib#{which_python}"
- if File.exists? "#{python_lib}.a"
- args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
- else
- args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
- end
- args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'"
- end
- else
- # Also disable Cython Python bindings if we're not building with '--python'
+ if python do
+ # For Xcode-only systems, the headers of system's python are inside of Xcode:
+ args << "-DPYTHON_INCLUDE_DIR='#{python.incdir}'"
+ # Cmake picks up the system's python dylib, even if we have a brewed one:
+ args << "-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'"
+ end; else
+ # Also disable Cython Python bindings if we're not building --with-python
args << "-DENABLE_CYTHON='OFF'"
end
@@ -66,16 +37,6 @@ class Libplist < Formula
end
def caveats
- if build.include? 'with-python'
- <<-EOS.undent
- To use the Python bindings with non-homebrew Python, you need to amend your
- PYTHONPATH like so:
- export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
- EOS
- end
- end
-
- def which_python
- "python" + `python -c 'import sys;print(sys.version[:3])'`.strip
+ python.standard_caveats if python
end
end