aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/shiboken.rb
diff options
context:
space:
mode:
authorXu Cheng2014-03-13 19:22:25 +0800
committerMike McQuaid2014-03-17 10:59:21 +0000
commitec3983059c6688b0d3f3d76a20f893bdce1ed220 (patch)
treee99cf6c764a7a084de8e90ccb390ed068f0113ce /Library/Formula/shiboken.rb
parent40b0d3834682789dd320f1bd775f3c60f85304e6 (diff)
downloadhomebrew-ec3983059c6688b0d3f3d76a20f893bdce1ed220.tar.bz2
pyside, shiboken: Python 3 support.
Diffstat (limited to 'Library/Formula/shiboken.rb')
-rw-r--r--Library/Formula/shiboken.rb33
1 files changed, 25 insertions, 8 deletions
diff --git a/Library/Formula/shiboken.rb b/Library/Formula/shiboken.rb
index 604500cb4..625188d6e 100644
--- a/Library/Formula/shiboken.rb
+++ b/Library/Formula/shiboken.rb
@@ -11,6 +11,9 @@ class Shiboken < Formula
depends_on 'cmake' => :build
depends_on 'qt'
+ depends_on :python => :recommended
+ depends_on :python3 => :optional
+
def patches
# This fixes issues with libc++ and its lack of the tr1 namespace.
# Upstream ticket: https://bugreports.qt-project.org/browse/PYSIDE-200
@@ -21,18 +24,32 @@ class Shiboken < Formula
def install
# As of 1.1.1 the install fails unless you do an out of tree build and put
# the source dir last in the args.
- mkdir "macbuild" do
- args = std_cmake_args
- # Building the tests also runs them.
- args << "-DBUILD_TESTS=ON"
- args << '..'
- system 'cmake', *args
- system "make install"
+ Language::Python.each_python(build) do |python, version|
+ mkdir "macbuild#{version}" do
+ args = std_cmake_args
+ # Building the tests also runs them.
+ args << "-DBUILD_TESTS=ON"
+ # if not System Python
+ python_framework = "#{Formula[python].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"
+ 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 << ".."
+ system "cmake", *args
+ system "make", "install"
+ end
end
end
test do
- system "python", "-c", "import shiboken"
+ Language::Python.each_python(build) do |python, version|
+ system python, "-c", "import shiboken"
+ end
end
end