class Pyqt5 < Formula desc "Python bindings for v5 of Qt" homepage "https://www.riverbankcomputing.com/software/pyqt/download5" url "https://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-5.6/PyQt5_gpl-5.6.tar.gz" sha256 "2e481a6c4c41b96ed3b33449e5f9599987c63a5c8db93313bd57a6acbf20f0e1" bottle do sha256 "1abcb70dac9e0ef7340c861895a0c726f5e5ce06e9f7d098c534fceea0672c89" => :sierra sha256 "4815f60529eadc829c704adbfb6a01ea2daec7acae4c4f7871579d3b01bdbc63" => :el_capitan sha256 "ac14ff2a18458c8201415adf3dfbd872849b0fef9968e105c4ce43e72876fcbf" => :yosemite sha256 "111602985fb4ced414dc4722a1af8ee3d428b2e013e22bdae8d0d059570ac44c" => :mavericks end option "with-debug", "Build with debug symbols" option "with-docs", "Install HTML documentation and python examples" deprecated_option "enable-debug" => "with-debug" depends_on :python3 => :recommended depends_on :python => :optional depends_on "qt5" if build.with? "python3" depends_on "sip" => "with-python3" else depends_on "sip" end def install if build.without?("python3") && build.without?("python") odie "pyqt5: --with-python3 must be specified when using --without-python" end Language::Python.each_python(build) do |python, version| args = ["--confirm-license", "--bindir=#{bin}", "--destdir=#{lib}/python#{version}/site-packages", "--stubsdir=#{lib}/python#{version}/site-packages/PyQt5", "--sipdir=#{share}/sip/Qt5", # sip.h could not be found automatically "--sip-incdir=#{Formula["sip"].opt_include}", # Make sure the qt5 version of qmake is found. # If qt4 is linked it will pickup that version otherwise. "--qmake=#{Formula["qt5"].bin}/qmake", # Force deployment target to avoid libc++ issues "QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}", "--qml-plugindir=#{pkgshare}/plugins", "--verbose"] args << "--debug" if build.with? "debug" system python, "configure.py", *args system "make" system "make", "install" system "make", "clean" end doc.install "doc/html", "examples" if build.with? "docs" end test do system "pyuic5", "--version" system "pylupdate5", "-version" Language::Python.each_python(build) do |python, _version| system python, "-c", "import PyQt5" %w[ Gui Location Multimedia Network Quick Svg WebEngineWidgets Widgets Xml ].each { |mod| system python, "-c", "import PyQt5.Qt#{mod}" } end end end