-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 pyinstaller/pyinstaller#5491 for details. To commit is to be reverted once PyInstaller has released a fix for this issue.
- Loading branch information
Showing
4 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.") |