Lorenzo Mancini wrote:
> I'm attaching a pyinstaller hook for PyOpenGL which builds and improves 
> on the one posted by Oscar a few days ago.  Namely:

...and thinking a little more about it, it doesn't make really sense to 
RuntimeError when PyOpenGL version doesn't match; if it's a <=3.0.0b6 
PyOpenGL it's not going to work anyway, and if it's an older 2.x 
version, those used to work as-is under pyinstaller.

I'm attaching the updated version.

-- 
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

## PyOpenGL 3.x versions previous to 3.0.0b6 have a plugin system based on
## pkg_resources which is problematic to handle correctly under pyinstaller.

## Moreover, PyOpenGL 2.x used to work as-is just fine, so we run this hook only
## with a recent (>=3.0.0b6) version of PyOpenGL (2.x doesn't need it and
## <3.0.0b6 wouldn't work anyway).

import OpenGL
if OpenGL.__version__ >= '3.0.0b6':

    ## PlatformPlugin performs a conditional import based on os.name and
    ## sys.platform. pyinstaller misses this so let's add it ourselves...

    import os
    import sys

    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

Reply via email to