From c616ffa2486a1f6873bc5e12602c1f54e17ff931 Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Wed, 20 Jan 2021 14:51:05 +0100 Subject: [PATCH 1/2] Explicitly sign all dylib files in the `Resources` folder `codesign --deep` does not seem to correctly sign dylibs in the `Resources` folder of the application bundle. This causes notarization to fail. Requires zsh to be installed via homebrew --- deployment/bundle_macos.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deployment/bundle_macos.sh b/deployment/bundle_macos.sh index 4062098934..56aeead6f7 100755 --- a/deployment/bundle_macos.sh +++ b/deployment/bundle_macos.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/local/bin/zsh pl_codesign () { sign="Developer ID Application: Pupil Labs UG (haftungsbeschrankt) (R55K9ESN6B)" @@ -45,6 +45,7 @@ mv dist/*.$ext ../$release_dir cd .. printf "\n##########\nSigning applications\n##########\n" +pl_codesign $release_dir/*.$ext/Contents/Resources/**/.dylibs/*.dylib pl_codesign $release_dir/*.$ext printf "\n##########\nCreating dmg file\n##########\n" From a3490315e3994b547393a47554b3591b2b7d3c5a Mon Sep 17 00:00:00 2001 From: Pablo Prietz Date: Wed, 20 Jan 2021 14:56:21 +0100 Subject: [PATCH 2/2] Temporary workaround for pyinstaller/pyinstaller#5491 Add a runtime hook to macOS bundles that patches `ctypes.util.find_library()` to return the correct OpenGL framwork path. Necessary, to make PyOpenGL work within the macOS bundles running on macOS Big Sur. See https://github.com/pyinstaller/pyinstaller/issues/5491 for details. To commit is to be reverted once PyInstaller has released a fix for this issue. --- deployment/deploy_capture/bundle.spec | 2 +- deployment/deploy_player/bundle.spec | 2 +- deployment/deploy_service/bundle.spec | 2 +- deployment/find_opengl_bigsur.py | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 deployment/find_opengl_bigsur.py diff --git a/deployment/deploy_capture/bundle.spec b/deployment/deploy_capture/bundle.spec index 494903681f..e8da02e1fa 100644 --- a/deployment/deploy_capture/bundle.spec +++ b/deployment/deploy_capture/bundle.spec @@ -52,7 +52,7 @@ if platform.system() == "Darwin": pathex=["../../pupil_src/shared_modules/"], hiddenimports=hidden_imports, hookspath=None, - runtime_hooks=None, + runtime_hooks=["../find_opengl_bigsur.py"], excludes=["matplotlib"], datas=data_files_pye3d, ) diff --git a/deployment/deploy_player/bundle.spec b/deployment/deploy_player/bundle.spec index 9e4b2cd912..2fb5afa28a 100644 --- a/deployment/deploy_player/bundle.spec +++ b/deployment/deploy_player/bundle.spec @@ -53,7 +53,7 @@ if platform.system() == "Darwin": pathex=["../../pupil_src/shared_modules/"], hiddenimports=hidden_imports, hookspath=None, - runtime_hooks=None, + runtime_hooks=["../find_opengl_bigsur.py"], excludes=["matplotlib"], datas=data_files_pye3d, ) diff --git a/deployment/deploy_service/bundle.spec b/deployment/deploy_service/bundle.spec index f91fb8bd2b..905271f3d6 100644 --- a/deployment/deploy_service/bundle.spec +++ b/deployment/deploy_service/bundle.spec @@ -43,7 +43,7 @@ if platform.system() == "Darwin": pathex=["../../pupil_src/shared_modules/"], hiddenimports=hidden_imports, hookspath=None, - runtime_hooks=None, + runtime_hooks=["../find_opengl_bigsur.py"], excludes=["matplotlib"], datas=data_files_pye3d, ) diff --git a/deployment/find_opengl_bigsur.py b/deployment/find_opengl_bigsur.py new file mode 100755 index 0000000000..292eaf04a4 --- /dev/null +++ b/deployment/find_opengl_bigsur.py @@ -0,0 +1,23 @@ +import ctypes.util +import functools + + +print("Attempting to import OpenGL using patched `ctypes.util.find_library`...") +_find_library_original = ctypes.util.find_library + +@functools.wraps(_find_library_original) +def _find_library_patched(name): + if name == "OpenGL": + return "/System/Library/Frameworks/OpenGL.framework/OpenGL" + else: + return _find_library_original(name) + +ctypes.util.find_library = _find_library_patched + +import OpenGL.GL + +print("OpenGL import successful!") +print("Restoring original `ctypes.util.find_library`...") +ctypes.util.find_library = _find_library_original +del _find_library_patched +print("Original `ctypes.util.find_library` restored.")