aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorChristian Moritz2014-02-07 20:17:14 +0100
committerMike McQuaid2014-02-07 23:01:26 +0000
commit620d89cbc0b562003b3ce82530adf635c86d3044 (patch)
tree95a1a7477d641fa349efccb8da260406a4a28d14 /Library
parent50cea4509754ecee1bad36323f4f74077c561493 (diff)
downloadhomebrew-620d89cbc0b562003b3ce82530adf635c86d3044.tar.bz2
pyqt5: python3 support
Closes #26499. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/pyqt5.rb81
1 files changed, 46 insertions, 35 deletions
diff --git a/Library/Formula/pyqt5.rb b/Library/Formula/pyqt5.rb
index 82f5bee5a..45f14b3ed 100644
--- a/Library/Formula/pyqt5.rb
+++ b/Library/Formula/pyqt5.rb
@@ -7,46 +7,57 @@ class Pyqt5 < Formula
option 'enable-debug', "Build with debug symbols"
- depends_on :python
+ depends_on :python3 => :recommended
+ depends_on :python => :optional
+
+ if (build.without? "python") && (build.without? "python3")
+ odie "pyqt: --with-python must be specified when using --without-python3"
+ end
+
depends_on 'qt5'
- depends_on 'sip'
+
+ if build.with? 'python3'
+ depends_on 'sip' => 'with-python3'
+ else
+ depends_on 'sip'
+ end
+
+ def pythons
+ pythons = []
+ ["python", "python3"].each do |python|
+ next if build.without? python
+ version = /\d\.\d/.match `#{python} --version 2>&1`
+ pythons << [python, version]
+ end
+ pythons
+ end
def install
- args = [ "--confirm-license",
- "--bindir=#{bin}",
- "--destdir=#{lib}/python2.7/site-packages",
- # To avoid conflicst with PyQt (for Qt4):
- "--sipdir=#{share}/sip/Qt5/",
- # sip.h could not be found automatically
- "--sip-incdir=#{Formula.factory('sip').opt_prefix}/include",
- # Force deployment target to avoid libc++ issues
- "QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" ]
- args << '--debug' if build.include? 'enable-debug'
-
- system "python", "configure.py", *args
- system "make"
- system "make", "install"
+ pythons.each do |python, version|
+ ENV["PYTHONPATH"] = lib/"python#{version}/site-packages"
+ args = [ "--confirm-license",
+ "--bindir=#{bin}",
+ "--destdir=#{lib}/python#{version}/site-packages",
+ # To avoid conflicst with PyQt (for Qt4):
+ "--sipdir=#{share}/sip/Qt5/",
+ # sip.h could not be found automatically
+ "--sip-incdir=#{Formula.factory('sip').opt_prefix}/include",
+ # Force deployment target to avoid libc++ issues
+ "QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" ]
+ args << '--debug' if build.include? 'enable-debug'
+
+ system python, "configure.py", *args
+ system "make"
+ system "make", "install"
+ system "make", "clean" if pythons.length > 1
+ end
end
test do
- (testpath/'test.py').write <<-EOS.undent
- import sys
- from PyQt5 import QtGui, QtCore, QtWidgets
-
- class Test(QtWidgets.QWidget):
- def __init__(self, parent=None):
- QtWidgets.QWidget.__init__(self, parent)
- self.setGeometry(300, 300, 400, 150)
- self.setWindowTitle('Homebrew')
- QtWidgets.QLabel("Python " + "{0}.{1}.{2}".format(*sys.version_info[0:3]) +
- " working with PyQt5. Quitting now...", self).move(50, 50)
- QtCore.QTimer.singleShot(1500, QtWidgets.qApp.quit)
-
- app = QtWidgets.QApplication([])
- window = Test()
- window.show()
- sys.exit(app.exec_())
- EOS
- system "python", "test.py"
+ system "pyuic5", "--version"
+ system "pylupdate5", "-version"
+ pythons.each do |python, version|
+ system python, "-c", "import PyQt5"
+ end
end
end