2009-10-30 10:46:25 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Pyqt < Formula
|
2009-10-30 10:46:25 +00:00
|
|
|
homepage 'http://www.riverbankcomputing.co.uk/software/pyqt'
|
2013-07-17 11:55:16 +00:00
|
|
|
url 'http://downloads.sf.net/project/pyqt/PyQt4/PyQt-4.10.2/PyQt-mac-gpl-4.10.2.tar.gz'
|
|
|
|
sha1 '40362e6b9f476683e4e35b83369e30a8dfff99ad'
|
2009-10-30 10:46:25 +00:00
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
depends_on :python => :recommended
|
|
|
|
depends_on :python3 => :optional
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
depends_on 'qt' # From their site: PyQt currently supports Qt v4 and will build against Qt v5
|
2009-11-05 18:13:00 +00:00
|
|
|
|
2013-06-05 13:00:41 +00:00
|
|
|
if build.with? 'python3'
|
|
|
|
depends_on 'sip' => 'with-python3'
|
|
|
|
else
|
|
|
|
depends_on 'sip'
|
|
|
|
end
|
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
def install
|
|
|
|
python do
|
|
|
|
system python, "./configure.py", "--confirm-license",
|
|
|
|
"--bindir=#{bin}#{python.if3then3}",
|
|
|
|
"--destdir=#{lib}/#{python.xy}/site-packages",
|
|
|
|
"--sipdir=#{share}/sip#{python.if3then3}"
|
|
|
|
system "make"
|
2013-07-17 11:55:16 +00:00
|
|
|
system "make", "install"
|
|
|
|
system "make", "clean" # because this python block may be run twice
|
2013-01-21 09:33:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if python3
|
|
|
|
# These tools need a unique suffix for python3.
|
|
|
|
['pyuic4', 'pyrcc4', 'pylupdate4'].each { |f| mv(prefix/"bin3/#{f}", bin/"#{f}-py3")}
|
|
|
|
rm_rf prefix/'bin3'
|
|
|
|
end
|
2012-02-08 18:42:19 +00:00
|
|
|
end
|
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
def caveats
|
|
|
|
python.standard_caveats if python
|
2009-11-05 18:13:00 +00:00
|
|
|
end
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
test do
|
2013-01-21 09:33:56 +00:00
|
|
|
python do
|
|
|
|
# Reference: http://zetcode.com/tutorials/pyqt4/firstprograms/
|
|
|
|
(testpath/'test.py').write <<-EOS.undent
|
|
|
|
import sys
|
|
|
|
from PyQt4 import QtGui, QtCore
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-06-05 08:26:57 +00:00
|
|
|
class Test(QtGui.QWidget):
|
2013-01-21 09:33:56 +00:00
|
|
|
def __init__(self, parent=None):
|
|
|
|
QtGui.QWidget.__init__(self, parent)
|
2013-06-05 08:26:57 +00:00
|
|
|
self.setGeometry(300, 300, 400, 150)
|
|
|
|
self.setWindowTitle('Homebrew')
|
|
|
|
QtGui.QLabel("Python #{python.version} working with PyQt4. Quitting now...", self).move(50, 50)
|
|
|
|
QtCore.QTimer.singleShot(2500, QtGui.qApp, QtCore.SLOT('quit()'))
|
|
|
|
|
|
|
|
app = QtGui.QApplication([])
|
|
|
|
window = Test()
|
|
|
|
window.show()
|
|
|
|
sys.exit(app.exec_())
|
2013-01-21 09:33:56 +00:00
|
|
|
EOS
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-01-21 09:33:56 +00:00
|
|
|
system python, "test.py"
|
|
|
|
rm testpath/'test.py'
|
|
|
|
end
|
2010-10-25 16:28:50 +00:00
|
|
|
end
|
2009-10-30 10:46:25 +00:00
|
|
|
end
|