bottle pyside and shiboken against system Python

pyside and shiboken can be built against system Python and imported with
Homebrew's Python; use `option "without-python"` instead of `depends_on
:python` in order to bottle against system Python so we don't install
Homebrew's python unnecessarily.

Closes Homebrew/homebrew#34945.
This commit is contained in:
Tim D. Smith 2014-12-12 21:23:31 -08:00
parent c2c7d2c470
commit d0c58d8d63
2 changed files with 9 additions and 9 deletions

View file

@ -8,7 +8,9 @@ class Pyside < Formula
head 'git://gitorious.org/pyside/pyside.git'
depends_on :python => :recommended
# don't use depends_on :python because then bottles install Homebrew's python
option "without-python", "Build without python 2 support"
depends_on :python => :recommended if MacOS.version <= :snow_leopard
depends_on :python3 => :optional
option "without-docs", "Skip building documentation"

View file

@ -18,7 +18,9 @@ class Shiboken < Formula
depends_on 'cmake' => :build
depends_on 'qt'
depends_on :python => :recommended
# don't use depends_on :python because then bottles install Homebrew's python
option "without-python", "Build without python 2 support"
depends_on :python => :recommended if MacOS.version <= :snow_leopard
depends_on :python3 => :optional
def install
@ -29,16 +31,12 @@ class Shiboken < Formula
args = std_cmake_args
# Building the tests also runs them.
args << "-DBUILD_TESTS=ON"
# if not System Python
python_framework = "#{Formula[python].opt_prefix}/Frameworks/Python.framework/Versions/#{version}"
if version.to_s[0,1] == "2" && Formula["python"].installed?
args << "-DPYTHON_INCLUDE_DIR:PATH=#{python_framework}/Headers"
args << "-DPYTHON_LIBRARY:FILEPATH=#{python_framework}/lib/libpython#{version}.dylib"
elsif version.to_s[0,1] == "3" && Formula["python3"].installed?
if python == "python3" && Formula["python3"].installed?
python_framework = (Formula["python3"].opt_prefix)/"Frameworks/Python.framework/Versions/#{version}"
args << "-DPYTHON3_INCLUDE_DIR:PATH=#{python_framework}/Headers"
args << "-DPYTHON3_LIBRARY:FILEPATH=#{python_framework}/lib/libpython#{version}.dylib"
args << "-DUSE_PYTHON3:BOOL=ON"
end
args << "-DUSE_PYTHON3:BOOL=ON" if python == "python3"
args << ".."
system "cmake", *args
system "make", "install"