From 2f5840aa6e2dfe8b62b469a2d88d0cdcd34cb217 Mon Sep 17 00:00:00 2001 From: PaperChalice Date: Thu, 4 Mar 2021 17:56:19 +0800 Subject: [PATCH] pyqt: 6.0.3 --- Aliases/pyqt@6 | 1 + Formula/pyqt.rb | 69 ++++++++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 33 deletions(-) create mode 120000 Aliases/pyqt@6 diff --git a/Aliases/pyqt@6 b/Aliases/pyqt@6 new file mode 120000 index 00000000000..e377862dfe9 --- /dev/null +++ b/Aliases/pyqt@6 @@ -0,0 +1 @@ +../Formula/pyqt.rb \ No newline at end of file diff --git a/Formula/pyqt.rb b/Formula/pyqt.rb index 059867f68eb..92a059383e9 100644 --- a/Formula/pyqt.rb +++ b/Formula/pyqt.rb @@ -1,10 +1,9 @@ class Pyqt < Formula - desc "Python bindings for v5 of Qt" - homepage "https://www.riverbankcomputing.com/software/pyqt/download5" - url "https://files.pythonhosted.org/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz" - sha256 "372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc" + desc "Python bindings for v6 of Qt" + homepage "https://www.riverbankcomputing.com/software/pyqt/intro" + url "https://files.pythonhosted.org/packages/29/4c/2f98c98536b957117ac02c3ffe027c3a66937c027f6b3506d6dd4aca3389/PyQt6-6.0.3.tar.gz" + sha256 "bfe5946a667080f7f755fb5acb92706c3e029bf7679d77fc3898f900f69f768a" license "GPL-3.0-only" - revision 1 bottle do sha256 cellar: :any, arm64_big_sur: "62dd04f103f14e2e1eaddf86a910150010272f3dbc65ccdc0f8a46b5c42838fb" @@ -13,51 +12,55 @@ class Pyqt < Formula sha256 cellar: :any, mojave: "0ad16dcf14f820bb1ecbd96974264d04f9c58ee8f8068cd7f47de88b275d8c1e" end + depends_on "pyqt-builder" => :build depends_on "python@3.9" - depends_on "qt@5" + depends_on "qt" depends_on "sip" - resource "PyQt5-sip" do - url "https://files.pythonhosted.org/packages/73/8c/c662b7ebc4b2407d8679da68e11c2a2eb275f5f2242a92610f6e5024c1f2/PyQt5_sip-12.8.1.tar.gz" - sha256 "30e944db9abee9cc757aea16906d4198129558533eb7fadbe48c5da2bd18e0bd" + resource "PyQt6-sip" do + url "https://files.pythonhosted.org/packages/95/7e/495d128a62a9f03bbfd71d764baccd44699cdcdeedb8db1dd4429e0646b2/PyQt6_sip-13.0.1.tar.gz" + sha256 "310d0c0efdbc086ef913f4ecdfaf8e62f2b70cadeacb42536bfe943c19709987" end def install - version = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3" - 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}", - "--qmake=#{Formula["qt@5"].bin}/qmake", - # Force deployment target to avoid libc++ issues - "QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}", - "--designer-plugindir=#{pkgshare}/plugins", - "--qml-plugindir=#{pkgshare}/plugins", - "--pyuic5-interpreter=#{Formula["python@3.9"].opt_bin}/python3", - "--verbose"] + python = Formula["python@3.9"] + args = %W[ + --target-dir #{prefix} + --no-make + --confirm-license + ] + system "sip-build", *args + cd "build" do + qt_prefix = Formula["qt"].prefix Formula["qt"].version + inreplace "inventory.txt", python.opt_prefix, prefix + inreplace "inventory.txt", qt_prefix, prefix + inreplace "Makefile", /(?<=\$\(INSTALL_ROOT\))#{Regexp.escape(python.opt_prefix)}/, prefix + inreplace "designer/Makefile", /(?<=\$\(INSTALL_ROOT\))#{Regexp.escape(qt_prefix)}/, prefix + inreplace "qmlscene/Makefile", /(?<=\$\(INSTALL_ROOT\))#{Regexp.escape(qt_prefix)}/, prefix + system "make", "install" + end - system Formula["python@3.9"].opt_bin/"python3", "configure.py", *args - system "make" - ENV.deparallelize { system "make", "install" } + xy = Language::Python.major_minor_version python.bin/"python3" + (lib/"python#{xy}/site-packages").install %W[#{prefix}/PyQt#{version.major} #{prefix}/PyQt#{version.major}-#{version}.dist-info] + + resource("PyQt6-sip").stage do + system Formula["python@3.9"].bin/"python3", *Language::Python.setup_install_args(prefix) + end end test do - system "#{bin}/pyuic5", "--version" - system "#{bin}/pylupdate5", "-version" + system "#{bin}/pyuic#{version.major}", "-V" + system "#{bin}/pylupdate#{version.major}", "-V" - system Formula["python@3.9"].opt_bin/"python3", "-c", "import PyQt5" + system Formula["python@3.9"].opt_bin/"python3", "-c", "import PyQt#{version.major}" + # TODO: add additional libraries in future: Position, Multimedia %w[ Gui - Location - Multimedia Network Quick Svg Widgets Xml - ].each { |mod| system Formula["python@3.9"].opt_bin/"python3", "-c", "import PyQt5.Qt#{mod}" } + ].each { |mod| system Formula["python@3.9"].opt_bin/"python3", "-c", "import PyQt#{version.major}.Qt#{mod}" } end end