fix qtwebengineprocess failing to load on darwin-aarch64

This commit is contained in:
Damien Elmes 2021-10-16 16:39:36 +10:00
parent e577bd12b8
commit d39e7be451

View file

@ -72,6 +72,10 @@ def merge_files(root, source):
else: else:
shutil.copy2(source_path, target_path) shutil.copy2(source_path, target_path)
def fix_webengine_codesigning(base: str):
"Fix a codesigning issue in the 6.2.0 release."
path = os.path.join(base, "PyQt6/Qt6/lib/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess")
subprocess.run(["codesign", "-s", "-", path], check=True)
def main(): def main():
base = sys.argv[1] base = sys.argv[1]
@ -101,11 +105,13 @@ def main():
("pyqt6-sip", "pyqt6_sip==13.1.0"), ("pyqt6-sip", "pyqt6_sip==13.1.0"),
] ]
arm_darwin = sys.platform.startswith("darwin") and platform.machine() == "arm64"
for (name, with_version) in packages: for (name, with_version) in packages:
# install package in subfolder # install package in subfolder
folder = os.path.join(base, "temp") folder = os.path.join(base, "temp")
pip_args = [] pip_args = []
if sys.platform.startswith("darwin") and platform.machine() == "arm64": if arm_darwin:
if name in ("pyqt6-qt6", "pyqt6-webengine-qt6"): if name in ("pyqt6-qt6", "pyqt6-webengine-qt6"):
# pyqt messed up the architecture tags # pyqt messed up the architecture tags
pip_args.extend( pip_args.extend(
@ -121,6 +127,9 @@ def main():
with open(os.path.join(base, "__init__.py"), "w") as file: with open(os.path.join(base, "__init__.py"), "w") as file:
file.write("__path__ = __import__('pkgutil').extend_path(__path__, __name__)") file.write("__path__ = __import__('pkgutil').extend_path(__path__, __name__)")
if arm_darwin:
fix_webengine_codesigning(base)
# add missing py.typed file # add missing py.typed file
with open(os.path.join(base, "py.typed"), "w") as file: with open(os.path.join(base, "py.typed"), "w") as file:
pass pass