homebrew-core/Formula/pyqt@5.rb

126 lines
5.0 KiB
Ruby

class PyqtAT5 < Formula
desc "Python bindings for v5 of Qt"
homepage "https://www.riverbankcomputing.com/software/pyqt/intro"
url "https://files.pythonhosted.org/packages/e1/57/2023316578646e1adab903caab714708422f83a57f97eb34a5d13510f4e1/PyQt5-5.15.7.tar.gz"
sha256 "755121a52b3a08cb07275c10ebb96576d36e320e572591db16cfdbc558101594"
license "GPL-3.0-only"
revision 1
bottle do
rebuild 2
sha256 cellar: :any, arm64_ventura: "6953bbf53e0815b53c6972c436daa4d75ca1bbb1e2c6b0c437848ac875d40139"
sha256 cellar: :any, arm64_monterey: "e1351de5c10e0064a0e576002c59d3d69b7017275f0989f268cf1e419abd91df"
sha256 cellar: :any, arm64_big_sur: "b3ef127911d0be14aa1917e53ad06365680c686fc148bccf0fd9d3e45ba5bed8"
sha256 cellar: :any, ventura: "686dd9b8390b87a8df634484063174bbc1c0309f154f62dc19ff810e082cd28f"
sha256 cellar: :any, monterey: "13ae8893173ea6a7ed64bd2d49ce50b3f9a52c45b6648cde607a7007a674ceaf"
sha256 cellar: :any, big_sur: "090ad920ef00f85f92d5d6d5f9c66ab1d24fe43208a9cb33e15de26c9e171e4c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "731f5031b417d938f1497549ec1a652163671d69875ba38940e29255748eff6d"
end
depends_on "pyqt-builder" => :build
depends_on "python@3.10" => [:build, :test]
depends_on "python@3.11" => [:build, :test]
depends_on "python@3.9" => [:build, :test]
depends_on "sip" => :build
depends_on "qt@5"
fails_with gcc: "5"
# extra components
resource "PyQt5-sip" do
url "https://files.pythonhosted.org/packages/39/5f/fd9384fdcb9cd0388088899c110838007f49f5da1dd1ef6749bfb728a5da/PyQt5_sip-12.11.0.tar.gz"
sha256 "b4710fd85b57edef716cc55fae45bfd5bfac6fc7ba91036f1dcc3f331ca0eb39"
end
resource "PyQt3D" do
url "https://files.pythonhosted.org/packages/44/af/58684ce08013c0e16839662844b29cd73259a909982c4d6517ce5ffda05f/PyQt3D-5.15.5.tar.gz"
sha256 "c025e8a2de12a27e3bd34671d01cac39f78305128cc6cea3f0ba99e4ca3ec41b"
end
resource "PyQtChart" do
url "https://files.pythonhosted.org/packages/eb/17/1d9bb859b3e09a06633264ad91249ede0abd68c1e3f2f948ae7df94702d3/PyQtChart-5.15.6.tar.gz"
sha256 "2691796fe92a294a617592a5c5c35e785dc91f7759def9eb22da79df63762339"
end
resource "PyQtDataVisualization" do
url "https://files.pythonhosted.org/packages/9c/ff/6ba767b4e1dbc32c7ffb93cd5d657048f6a4edf318c5b8810c8931a1733b/PyQtDataVisualization-5.15.5.tar.gz"
sha256 "8927f8f7aa70857ef00c51e3dfbf6f83dd9f3855f416e0d531592761cbb9dc7f"
end
resource "PyQtNetworkAuth" do
url "https://files.pythonhosted.org/packages/85/b6/6b8f30ebd7c15ded3d91ed8d6082dee8aebaf79c4e8d5af77b1172c805c2/PyQtNetworkAuth-5.15.5.tar.gz"
sha256 "2230b6f56f4c9ad2e88bf5ac648e2f3bee9cd757550de0fb98fe0bcb31217b16"
end
resource "PyQtWebEngine" do
url "https://files.pythonhosted.org/packages/cf/4b/ca01d875eff114ba5221ce9311912fbbc142b7bb4cbc4435e04f4f1f73cb/PyQtWebEngine-5.15.6.tar.gz"
sha256 "ae241ef2a61c782939c58b52c2aea53ad99b30f3934c8358d5e0a6ebb3fd0721"
end
resource "PyQtPurchasing" do
url "https://files.pythonhosted.org/packages/41/2a/354f0ae3fa02708719e2ed6a8c310da4283bf9a589e2a7fcf7dadb9638af/PyQtPurchasing-5.15.5.tar.gz"
sha256 "8bb1df553ba6a615f8ec3d9b9c5270db3e15e831a6161773dabfdc1a7afe4834"
end
def pythons
deps.map(&:to_formula)
.select { |f| f.name.match?(/^python@\d\.\d+$/) }
.map { |f| f.opt_libexec/"bin/python" }
end
def install
components = %w[PyQt3D PyQtChart PyQtDataVisualization PyQtNetworkAuth PyQtWebEngine PyQtPurchasing]
pythons.each do |python|
site_packages = prefix/Language::Python.site_packages(python)
args = [
"--target-dir", site_packages,
"--scripts-dir", bin,
"--confirm-license",
"--no-designer-plugin",
"--no-qml-plugin"
]
system "sip-install", *args
resource("PyQt5-sip").stage do
system python, *Language::Python.setup_install_args(prefix, python)
end
components.each do |p|
resource(p).stage do
inreplace "pyproject.toml", "[tool.sip.project]", <<~EOS
[tool.sip.project]
sip-include-dirs = ["#{site_packages}/PyQt#{version.major}/bindings"]
EOS
system "sip-install", "--target-dir", site_packages
end
end
end
# Replace hardcoded reference to Python version used with sip/pyqt-builder with generic python3.
bin.children.each { |script| inreplace script, Formula["python@3.11"].opt_bin/"python3.11", "python3" }
end
test do
system bin/"pyuic#{version.major}", "--version"
system bin/"pylupdate#{version.major}", "-version"
components = %w[
Gui
Location
Multimedia
Network
Quick
Svg
WebEngineWidgets
Widgets
Xml
]
pythons.each do |python|
system python, "-c", "import PyQt#{version.major}"
components.each { |mod| system python, "-c", "import PyQt5.Qt#{mod}" }
end
end
end