After fiddling with the McMillian Installer
my little PyOpenGL client application, I found what was
causing the OpenGL import to fail -- the reading of the
"version" file in the root of the package.
If you are not familar with the McMillian Installer, it
effecitvely zips up all modules and packages your
application is dependent upon, and packs that
information to the tail end of an executable file. It
does this by detecting all imports and also has a
mechanism for adding modules manually. However, it
does not have a mechanism for detecting or including
standard files in the fashion that OpenGL/__init__.py
file is using. So therefore, it has trouble importing
OpenGL in the McMillian Installer, and thus my patch. :)
There are a few ways in which we can accomplish fixing
1. We could hard code the version number in the
__init__.py (yuck! -- that's why there is a "version"
file in the first place)
2. We can do a try/except block around the reading of
the file. (what value does OpenGL.__version__ get when
this error occurs? If we set it to some default value,
this potentially changes the behavior of any version
dependent code in the application. This is
undersierable... I like things to work the same in or
out of the packaging.
3. We can rename "version" to "__version__.py", change
the syntax slightly, and change the "__init__.py" file
to deal with those new changes. (This allows packaging
implementations like Installer and cx_Freeze detect the
import and include it in the packaging.)
I like the 3rd option the best, and thereby have
created a patch to implement that feature.