pyqt: improve the formula

master
PaperChalice 2021-03-24 12:18:51 +08:00 committed by Carlo Cabrera
parent 3b9d1ad9c5
commit 5e5b9c501d
1 changed files with 5 additions and 8 deletions

View File

@ -24,25 +24,22 @@ class Pyqt < Formula
def install
python = Formula["python@3.9"]
site_packages = prefix/Language::Python.site_packages(python)
# HACK: there is no option to set the plugindir
inreplace "project.py", "builder.qt_configuration['QT_INSTALL_PLUGINS']", "'#{share}/qt/plugins'"
args = %W[
--target-dir #{prefix}
--target-dir #{site_packages}
--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
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