don't bundle Qt into ARM Linux package

While it worked, it was not portable to other distros, so we'll rely
on the user to provide their own (Py)Qt.
This commit is contained in:
Damien Elmes 2021-12-09 15:56:00 +10:00
parent 08ad9f33b9
commit e11cad9bf7
2 changed files with 15 additions and 62 deletions

View file

@ -62,11 +62,8 @@ else:
else:
os.environ["TARGET"] = "aarch64-unknown-linux-gnu"
pyqt5_folder_name = None
pyqt6_folder_path = None
arm64_linux = True
# path to a custom-built/prepared PyQt5 folder
# must be provided
pyqt6_folder_path = os.getenv("PREPARED_QT_PATH")
assert pyqt6_folder_path
python = python_bin_folder / "python"
@ -197,22 +194,23 @@ def adj_path_for_windows_rsync(path: Path) -> str:
return f"/{path.drive[0]}{rest}"
def merge_into_dist(output_folder: Path, pyqt_src_path: Path):
def merge_into_dist(output_folder: Path, pyqt_src_path: Path | None):
if not output_folder.exists():
output_folder.mkdir(parents=True)
# PyQt
subprocess.run(
[
"rsync",
"-a",
"--delete",
"--exclude-from",
"qt.exclude",
adj_path_for_windows_rsync(pyqt_src_path),
adj_path_for_windows_rsync(output_folder / "lib") + "/",
],
check=True,
)
if pyqt_src_path:
subprocess.run(
[
"rsync",
"-a",
"--delete",
"--exclude-from",
"qt.exclude",
adj_path_for_windows_rsync(pyqt_src_path),
adj_path_for_windows_rsync(output_folder / "lib") + "/",
],
check=True,
)
# Executable and other resources
resources = [
adj_path_for_windows_rsync(
@ -241,12 +239,6 @@ def merge_into_dist(output_folder: Path, pyqt_src_path: Path):
)
# Linux ARM workarounds
if arm64_linux:
with open(output_folder / "qt.conf", "w") as file:
file.write(
"""[Paths]
Prefix = lib/PyQt5/Qt5
"""
)
# copy orjson ends up broken; copy from venv
subprocess.run(
[

View file

@ -1,39 +0,0 @@
#!/bin/bash
#
# This script copies a system-installed PyQt. Written for Debian Bullseye;
# will need adjusting for other platforms.
set -e
sudo apt install -y python3-pyqt5.{qtwebengine,qtmultimedia} patchelf
pyqtBase=/usr/lib/python3/dist-packages/PyQt5
qtData=/usr/share/qt5
qtLibBase=/usr/lib/aarch64-linux-gnu
qtLibExtra=$qtLibBase/qt5
outDir=~/PyQtPrepared/PyQt5/
qtOutputBase=$outDir/Qt5
rm -rf $outDir
mkdir -p $qtOutputBase
# pyqt
rsync -ai --exclude-from=qt.exclude --exclude Qt5 \
$pyqtBase/ $outDir/
patchelf --set-rpath '$ORIGIN/Qt5/lib' $outDir/*.so
# qt libs
rsync -ai $qtLibBase/libQt5* $qtOutputBase/lib/
patchelf --set-rpath '$ORIGIN' $qtOutputBase/lib/*.so.*
# qt libexec/plugins
rsync -ai --exclude=qml $qtLibExtra/ $qtOutputBase/
patchelf --set-rpath '$ORIGIN/../../lib' $qtOutputBase/plugins/*/*.so
patchelf --set-rpath '$ORIGIN/../lib' $qtOutputBase/libexec/QtWebEngineProcess
cat > $qtOutputBase/libexec/qt.conf <<EOF
[Paths]
Prefix = ..
EOF
# qt translations/resources
rsync -ai $qtData/ $qtOutputBase/