I'm attaching a pyinstaller hook for PyOpenGL which builds and improves
on the one posted by Oscar a few days ago. Namely:
* adds a version check, because versions of PyOpenGL previous to
3.0.0b6 still use the pkg_resources-based plugin system;
* uses both os.name and sys.platform to guess which system we are
running on (os.name will never return "darwin" AFAIK);
* adds some hidden imports for the OpenGL.arrays.* modules, that I
needed on my linux system.
HTH
--
Lorenzo Mancini
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---
########################################## pyinstaller/hooks/hook-OpenGL.py
import os
import sys
import OpenGL
## PyOpenGL versions previous to 3.0.0b6 have a plugin system based on
## pkg_resources which is problematic to handle correctly under pyinstaller.
if OpenGL.__version__ < "3.0.0b6":
raise RuntimeError, "PyOpenGL >=3.0.0b6 required"
## PlatformPlugin performs a conditional import based on os.name and
## sys.platform. pyinstaller misses this so let's add it ourselves...
if os.name == 'nt":
hiddenimports = ['OpenGL.platform.win32']
else:
if sys.platform == "linux2":
hiddenimports = ['OpenGL.platform.glx']
elif sys.platform == "darwin":
hiddenimports = ['OpenGL.platform.darwin']
else:
print "ERROR: hook-OpenGL: Unrecognised combo (os.name: %s, sys.platform: %s)" % (os.name, sys.platform)
## arrays modules are needed too
hiddenimports += ['OpenGL.arrays.ctypesparameters',
'OpenGL.arrays.numarrays',
'OpenGL.arrays._numeric',
'OpenGL.arrays._strings',
'OpenGL.arrays.ctypespointers',
'OpenGL.arrays.lists',
'OpenGL.arrays.numbers',
'OpenGL.arrays.numeric',
'OpenGL.arrays.strings',
'OpenGL.arrays.ctypesarrays',
'OpenGL.arrays.nones',
'OpenGL.arrays.numericnames',
'OpenGL.arrays.numpymodule',
'OpenGL.arrays.vbo',
]
########################################## pyinstaller/hooks/hook-OpenGL.py