94 lines
3.4 KiB
Ruby
94 lines
3.4 KiB
Ruby
class Pyqt < Formula
|
|
desc "Python bindings for Qt"
|
|
homepage "http://www.riverbankcomputing.co.uk/software/pyqt"
|
|
url "https://downloads.sf.net/project/pyqt/PyQt4/PyQt-4.11.3/PyQt-mac-gpl-4.11.3.tar.gz"
|
|
sha256 "8b8bb3a2ef8b7368710e0bc59d6e94e1f513f7dbf10a3aaa3154f7b848c88b4d"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "45a0bd946b7eca2af72aa3e56bda87ad90ef54bda91f0aea05c0ea2d50d6e8c4" => :el_capitan
|
|
sha256 "6a5726eb3dff684c7052ea52db633f8c5333a947f97bdfab887e204b846abd7c" => :yosemite
|
|
sha256 "c0edd4c00b302e8e5baaa87b2c9d0e2037e93b42b0aec007dd24b80b4fbed847" => :mavericks
|
|
end
|
|
|
|
option "without-python", "Build without python 2 support"
|
|
depends_on :python3 => :optional
|
|
|
|
if build.without?("python3") && build.without?("python")
|
|
odie "pyqt: --with-python3 must be specified when using --without-python"
|
|
end
|
|
|
|
depends_on "qt"
|
|
|
|
if build.with? "python3"
|
|
depends_on "sip" => "with-python3"
|
|
else
|
|
depends_on "sip"
|
|
end
|
|
|
|
def install
|
|
# On Mavericks we want to target libc++, this requires a non default qt makespec
|
|
if ENV.compiler == :clang && MacOS.version >= :mavericks
|
|
ENV.append "QMAKESPEC", "unsupported/macx-clang-libc++"
|
|
end
|
|
|
|
Language::Python.each_python(build) do |python, version|
|
|
ENV.append_path "PYTHONPATH", "#{Formula["sip"].opt_lib}/python#{version}/site-packages"
|
|
|
|
args = ["--confirm-license",
|
|
"--bindir=#{bin}",
|
|
"--destdir=#{lib}/python#{version}/site-packages",
|
|
"--sipdir=#{share}/sip"]
|
|
|
|
# We need to run "configure.py" so that pyqtconfig.py is generated, which
|
|
# is needed by QGIS, PyQWT (and many other PyQt interoperable
|
|
# implementations such as the ROS GUI libs). This file is currently needed
|
|
# for generating build files appropriate for the qmake spec that was used
|
|
# to build Qt. The alternatives provided by configure-ng.py is not
|
|
# sufficient to replace pyqtconfig.py yet (see
|
|
# https://github.com/qgis/QGIS/pull/1508). Using configure.py is
|
|
# deprecated and will be removed with SIP v5, so we do the actual compile
|
|
# using the newer configure-ng.py as recommended. In order not to
|
|
# interfere with the build using configure-ng.py, we run configure.py in a
|
|
# temporary directory and only retain the pyqtconfig.py from that.
|
|
|
|
require "tmpdir"
|
|
dir = Dir.mktmpdir
|
|
begin
|
|
cp_r(Dir.glob("*"), dir)
|
|
cd dir do
|
|
system python, "configure.py", *args
|
|
inreplace "pyqtconfig.py", Formula["qt"].prefix, Formula["qt"].opt_prefix
|
|
(lib/"python#{version}/site-packages/PyQt4").install "pyqtconfig.py"
|
|
end
|
|
ensure
|
|
remove_entry_secure dir
|
|
end
|
|
|
|
# On Mavericks we want to target libc++, this requires a non default qt makespec
|
|
if ENV.compiler == :clang && MacOS.version >= :mavericks
|
|
args << "--spec" << "unsupported/macx-clang-libc++"
|
|
end
|
|
|
|
system python, "configure-ng.py", *args
|
|
system "make"
|
|
system "make", "install"
|
|
system "make", "clean" # for when building against multiple Pythons
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
"Phonon support is broken."
|
|
end
|
|
|
|
test do
|
|
Pathname("test.py").write <<-EOS.undent
|
|
from PyQt4 import QtNetwork
|
|
QtNetwork.QNetworkAccessManager().networkAccessible()
|
|
EOS
|
|
|
|
Language::Python.each_python(build) do |python, _version|
|
|
system python, "test.py"
|
|
end
|
|
end
|
|
end
|