diff options
| author | Samuel John | 2013-07-17 19:32:18 +0200 |
|---|---|---|
| committer | Samuel John | 2013-07-19 13:42:34 +0200 |
| commit | 15f25169302a81e090eaff0957248bbbcfd63bd2 (patch) | |
| tree | 48fad000df3686fc13b7aebeb2a1b6fc82cee2e7 /Library/Formula/pyqt5.rb | |
| parent | f9085c2621d1db1341d6a49b36595564e4662c1f (diff) | |
| download | homebrew-15f25169302a81e090eaff0957248bbbcfd63bd2.tar.bz2 | |
PyQt5: PyQt5 for Qt5.
Diffstat (limited to 'Library/Formula/pyqt5.rb')
| -rw-r--r-- | Library/Formula/pyqt5.rb | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/Library/Formula/pyqt5.rb b/Library/Formula/pyqt5.rb new file mode 100644 index 000000000..e1f156210 --- /dev/null +++ b/Library/Formula/pyqt5.rb @@ -0,0 +1,72 @@ +require 'formula' + +class Pyqt5 < Formula + homepage 'http://www.riverbankcomputing.co.uk/software/pyqt/download5' + url 'http://downloads.sf.net/project/pyqt/PyQt5/PyQt-5.0/PyQt-gpl-5.0.tar.gz' + sha1 'ad143f8c1287e80f37db23618c9560b00f89bc60' + + 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 + "--sip-incdir=#{Formula.factory('sip').opt_prefix}/include" ] + 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 + if build.with? 'python3' and build.with? 'python' + ['pyuic5', 'pyrcc5', 'pylupdate5'].each { |f| mv(bin/f, bin/"#{f}-py2")} + end + end + end + + def caveats + python.standard_caveats if python + end + + test do + python 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 #{python.version} working with PyQt5. Quitting now...", self).move(50, 50) + QtCore.QTimer.singleShot(2500, QtWidgets.qApp.quit) + + app = QtWidgets.QApplication([]) + window = Test() + window.show() + sys.exit(app.exec_()) + EOS + + system "python#{python.if3then3}", "test.py" + rm testpath/'test.py' + end + end +end |
