2009-10-30 10:46:25 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2010-07-13 21:07:54 +00:00
|
|
|
# Note: this project doesn't save old releases, so it breaks often as
|
|
|
|
# downloads disappear.
|
2009-11-05 18:13:00 +00:00
|
|
|
|
2009-10-30 10:46:25 +00:00
|
|
|
class Pyqt <Formula
|
2011-02-06 19:45:48 +00:00
|
|
|
url 'http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.8.3.tar.gz'
|
2009-10-30 10:46:25 +00:00
|
|
|
homepage 'http://www.riverbankcomputing.co.uk/software/pyqt'
|
2011-02-06 19:45:48 +00:00
|
|
|
md5 '14bade8b251660177ccc1a0cbbe33aba'
|
2009-10-30 10:46:25 +00:00
|
|
|
|
2009-11-05 18:13:00 +00:00
|
|
|
depends_on 'sip'
|
2009-10-30 10:46:25 +00:00
|
|
|
depends_on 'qt'
|
|
|
|
|
|
|
|
def install
|
2009-11-05 18:13:00 +00:00
|
|
|
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/python", ':'
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2010-10-25 12:19:39 +00:00
|
|
|
system "python", "./configure.py", "--confirm-license",
|
2009-11-05 18:13:00 +00:00
|
|
|
"--bindir=#{bin}",
|
|
|
|
"--destdir=#{lib}/python",
|
|
|
|
"--sipdir=#{share}/sip"
|
|
|
|
system "make"
|
2009-10-30 10:46:25 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
2009-11-05 18:13:00 +00:00
|
|
|
|
2010-07-13 21:07:54 +00:00
|
|
|
def caveats; <<-EOS
|
|
|
|
This formula won't function until you amend your PYTHONPATH like so:
|
2010-07-18 15:38:16 +00:00
|
|
|
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH
|
2010-07-13 21:07:54 +00:00
|
|
|
EOS
|
2009-11-05 18:13:00 +00:00
|
|
|
end
|
2010-10-25 16:28:50 +00:00
|
|
|
|
|
|
|
def test
|
|
|
|
test_program = <<-EOS
|
|
|
|
#!/usr/bin/env python
|
|
|
|
# Taken from: http://zetcode.com/tutorials/pyqt4/firstprograms/
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from PyQt4 import QtGui, QtCore
|
|
|
|
|
|
|
|
|
|
|
|
class QuitButton(QtGui.QWidget):
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
QtGui.QWidget.__init__(self, parent)
|
|
|
|
|
|
|
|
self.setGeometry(300, 300, 250, 150)
|
|
|
|
self.setWindowTitle('Quit button')
|
|
|
|
|
|
|
|
quit = QtGui.QPushButton('Close', self)
|
|
|
|
quit.setGeometry(10, 10, 60, 35)
|
|
|
|
|
|
|
|
self.connect(quit, QtCore.SIGNAL('clicked()'),
|
|
|
|
QtGui.qApp, QtCore.SLOT('quit()'))
|
|
|
|
|
|
|
|
|
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
qb = QuitButton()
|
|
|
|
qb.show()
|
|
|
|
app.exec_()
|
|
|
|
sys.exit(0)
|
|
|
|
EOS
|
|
|
|
|
|
|
|
ohai "Writing test script 'test_pyqt.py'."
|
|
|
|
open("test_pyqt.py", "w+") do |file|
|
|
|
|
file.write test_program
|
|
|
|
end
|
|
|
|
|
|
|
|
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/python", ':'
|
|
|
|
system "python test_pyqt.py"
|
|
|
|
|
|
|
|
ohai "Removing test script 'test_pyqt.py'."
|
|
|
|
rm "test_pyqt.py"
|
|
|
|
end
|
2009-10-30 10:46:25 +00:00
|
|
|
end
|