2013-07-17 17:32:18 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Pyqt5 < Formula
|
|
|
|
homepage 'http://www.riverbankcomputing.co.uk/software/pyqt/download5'
|
2013-11-02 11:30:23 +00:00
|
|
|
url 'http://downloads.sf.net/project/pyqt/PyQt5/PyQt-5.1.1/PyQt-gpl-5.1.1.tar.gz'
|
|
|
|
sha1 '90a3d6a805da7559ad83704866c1751d698f1873'
|
2013-07-17 17:32:18 +00:00
|
|
|
|
|
|
|
option 'enable-debug', "Build with debug symbols"
|
|
|
|
|
|
|
|
depends_on :python3 => :recommended
|
|
|
|
depends_on :python2 => :optional
|
|
|
|
|
|
|
|
depends_on 'qt5'
|
|
|
|
|
|
|
|
if build.with? 'python3'
|
|
|
|
depends_on 'sip' => 'with-python3'
|
|
|
|
else
|
|
|
|
depends_on 'sip'
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
python do
|
|
|
|
args = [ "--confirm-license",
|
|
|
|
"--bindir=#{bin}",
|
|
|
|
"--destdir=#{lib}/#{python.xy}/site-packages",
|
|
|
|
# To avoid conflicst with PyQt (for Qt4):
|
|
|
|
"--sipdir=#{share}/sip#{python.if3then3}/Qt5/",
|
|
|
|
# sip.h could not be found automatically
|
2013-11-02 11:30:23 +00:00
|
|
|
"--sip-incdir=#{Formula.factory('sip').opt_prefix}/include",
|
|
|
|
# Force deployment target to avoid libc++ issues
|
|
|
|
"QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" ]
|
2013-07-17 17:32:18 +00:00
|
|
|
args << '--debug' if build.include? 'enable-debug'
|
|
|
|
|
|
|
|
system python, "./configure.py", *args
|
|
|
|
system "make"
|
|
|
|
system "make", "install"
|
|
|
|
system "make", "clean" # because this python block may be run twice
|
|
|
|
|
|
|
|
# For PyQt5 we default to put 3.x bindings in bin, unless --without-python3
|
2013-11-02 19:38:13 +00:00
|
|
|
if python.version.major == 2 and build.with? 'python3'
|
|
|
|
['pyuic5', 'pyrcc5', 'pylupdate5'].each { |f| mv bin/f, bin/"#{f}-py2" }
|
2013-07-17 17:32:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
python.standard_caveats if python
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2013-08-08 10:18:06 +00:00
|
|
|
# To test Python 2.x, you have to `brew test pyqt --with-python`
|
|
|
|
(testpath/'test.py').write <<-EOS.undent
|
|
|
|
import sys
|
|
|
|
from PyQt5 import QtGui, QtCore, QtWidgets
|
2013-07-17 17:32:18 +00:00
|
|
|
|
2013-08-08 10:18:06 +00:00
|
|
|
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)
|
2013-07-17 17:32:18 +00:00
|
|
|
|
2013-08-08 10:18:06 +00:00
|
|
|
app = QtWidgets.QApplication([])
|
|
|
|
window = Test()
|
|
|
|
window.show()
|
|
|
|
sys.exit(app.exec_())
|
|
|
|
EOS
|
|
|
|
python do
|
|
|
|
system python, "test.py"
|
2013-07-17 17:32:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|