diff --git a/doc/CHANGES.txt b/doc/CHANGES.txt index 22df7ea..23afb97 100644 --- a/doc/CHANGES.txt +++ b/doc/CHANGES.txt @@ -9,6 +9,7 @@ Current changes since PyInstaller 1.0 the encodings are automatically found and included, so this problem should be gone forever. + Add import hook for GTK. + + Add import hook for PyOpenGL. + Add import hook for dnspython (tested with 1.3.4) + Add import hook for KInterbasDB (courtesy of Eugene Prigorodov) + (Windows) Make single-file packages not depend on MSVCRT71.DLL anymore, diff --git a/rthooks.dat b/rthooks.dat index 6a038a4..fae6ed1 100644 --- a/rthooks.dat +++ b/rthooks.dat @@ -2,4 +2,5 @@ 'pythoncom': ['support/rthooks/versioneddll.py'], 'pywintypes': ['support/rthooks/versioneddll.py'], 'win32com': ['support/rthooks/win32comgenpy.py'], + 'OpenGL': ['support/rthooks/opengl.py'], } diff --git a/support/rthooks/opengl.py b/support/rthooks/opengl.py new file mode 100644 index 0000000..d2ca989 --- /dev/null +++ b/support/rthooks/opengl.py @@ -0,0 +1,48 @@ +# Copyright (C) 2005, Giovanni Bajo +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# In addition to the permissions in the GNU General Public License, the +# authors give you unlimited permission to link or embed the compiled +# version of this file into combinations with other programs, and to +# distribute those combinations without any restriction coming from the +# use of this file. (The General Public License restrictions do apply in +# other respects; for example, they cover modification of the file, and +# distribution when not linked into a combine executable.) +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +# PyOpenGL (specifically, OpenGL.__init__) reads a "version" text file +# containing the version number to export it as OpenGL.__version__. When +# packaging with PyInstaller, the 'version' file does not exist, and importing +# PyOpenGL results in an IOError. +# The (convoluted) solution is to override Python's builtin "open" with our +# own function which detects when "version" is opened and returns some fake +# content stream (through cStringIO). + +__realopen__ = open + +def myopen(fn, *args): + import os + lastdir = os.path.basename(os.path.dirname(fn)) + if os.path.basename(fn) == "version" and os.path.splitext(lastdir)[1] == ".pyz": + import cStringIO + # Restore original open, since we're almost done + __builtins__.__dict__["open"] = __realopen__ + # Report a fake revision number. Anything would do since it's not + # used by the library, but it needs to be made of four numbers + # separated by dots. + return cStringIO.StringIO("0.0.0.0") + return __realopen__(fn, *args) + +__builtins__.__dict__["open"] = myopen