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
|
|
|
|
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-05-18 23:19:53 +00:00
|
|
|
url 'http://downloads.sf.net/project/pyqt/PyQt4/PyQt-4.10.1/PyQt-mac-gpl-4.10.1.tar.gz'
|
|
|
|
sha1 'cf20699c4db8d3031c19dd51df8857bba1a4956b'
|
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
|
2012-03-09 21:52:03 +00:00
|
|
|
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
|
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}",
|
2012-02-08 18:42:19 +00:00
|
|
|
"--destdir=#{lib}/#{which_python}/site-packages",
|
2009-11-05 18:13:00 +00:00
|
|
|
"--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
|
|
|
|
2012-02-08 18:42:19 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
For non-homebrew Python, you need to amend your PYTHONPATH like so:
|
|
|
|
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def which_python
|
|
|
|
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
|
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
|
|
|
|
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
# Reference: http://zetcode.com/tutorials/pyqt4/firstprograms/
|
|
|
|
(testpath/'test.py').write <<-EOS.undent
|
|
|
|
#!/usr/bin/env python
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
import sys
|
|
|
|
from PyQt4 import QtGui, QtCore
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
class QuitButton(QtGui.QWidget):
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
QtGui.QWidget.__init__(self, parent)
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
self.setGeometry(300, 300, 250, 150)
|
|
|
|
self.setWindowTitle('Quit button')
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
quit = QtGui.QPushButton('Close', self)
|
|
|
|
quit.setGeometry(10, 10, 60, 35)
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
self.connect(quit, QtCore.SIGNAL('clicked()'),
|
|
|
|
QtGui.qApp, QtCore.SLOT('quit()'))
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
qb = QuitButton()
|
|
|
|
qb.show()
|
|
|
|
app.exec_()
|
|
|
|
sys.exit(0)
|
|
|
|
EOS
|
2010-10-25 16:28:50 +00:00
|
|
|
|
2013-02-02 05:12:50 +00:00
|
|
|
system "python", "test.py"
|
2010-10-25 16:28:50 +00:00
|
|
|
end
|
2009-10-30 10:46:25 +00:00
|
|
|
end
|