aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2014-03-13 19:22:25 +0800
committerMike McQuaid2014-03-17 10:59:21 +0000
commitec3983059c6688b0d3f3d76a20f893bdce1ed220 (patch)
treee99cf6c764a7a084de8e90ccb390ed068f0113ce
parent40b0d3834682789dd320f1bd775f3c60f85304e6 (diff)
downloadhomebrew-ec3983059c6688b0d3f3d76a20f893bdce1ed220.tar.bz2
pyside, shiboken: Python 3 support.
-rw-r--r--Library/Formula/pyside.rb47
-rw-r--r--Library/Formula/shiboken.rb33
2 files changed, 58 insertions, 22 deletions
diff --git a/Library/Formula/pyside.rb b/Library/Formula/pyside.rb
index 2ea12f518..5b2e9a046 100644
--- a/Library/Formula/pyside.rb
+++ b/Library/Formula/pyside.rb
@@ -8,12 +8,20 @@ class Pyside < Formula
head 'git://gitorious.org/pyside/pyside.git'
+ depends_on :python => :recommended
+ depends_on :python3 => :optional
+
option "without-docs", "Skip building documentation"
depends_on 'cmake' => :build
- depends_on 'shiboken'
depends_on 'qt'
+ if build.with? 'python3'
+ depends_on 'shiboken' => 'with-python3'
+ else
+ depends_on 'shiboken'
+ end
+
def patches
DATA # Fix moc_qpytextobject.cxx not found (https://codereview.qt-project.org/62479)
end
@@ -41,23 +49,34 @@ class Pyside < Formula
# Add out of tree build because one of its deps, shiboken, itself needs an
# out of tree build in shiboken.rb.
- mkdir "macbuild" do
- qt = Formula["qt"].opt_prefix
- args = std_cmake_args + %W[
- -DSITE_PACKAGE=#{lib}/python2.7/site-packages
- -DALTERNATIVE_QT_INCLUDE_DIR=#{qt}/include
- -DQT_SRC_DIR=#{qt}/src
- -DPYTHON_SUFFIX='-python2.7'
- ..
- ]
- system 'cmake', *args
- system 'make'
- system 'make', 'install'
+ Language::Python.each_python(build) do |python, version|
+ mkdir "macbuild#{version}" do
+ qt = Formula["qt"].opt_prefix
+ args = std_cmake_args + %W[
+ -DSITE_PACKAGE=#{lib}/python#{version}/site-packages
+ -DALTERNATIVE_QT_INCLUDE_DIR=#{qt}/include
+ -DQT_SRC_DIR=#{qt}/src
+ ]
+ if version.to_s[0,1] == "2"
+ args << "-DPYTHON_SUFFIX=-python#{version}"
+ else
+ major_version = version.to_s[0,1]
+ minor_version = version.to_s[2,3]
+ args << "-DPYTHON_SUFFIX=.cpython-#{major_version}#{minor_version}m"
+ args << "-DUSE_PYTHON3=1"
+ end
+ args << ".."
+ system "cmake", *args
+ system "make"
+ system "make", "install"
+ end
end
end
test do
- system 'python', '-c', "from PySide import QtCore"
+ Language::Python.each_python(build) do |python, version|
+ system python, "-c", "from PySide import QtCore"
+ end
end
end
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