March 16 2012

Install pygtkglext 1.1.0 (win32)

Pygtkglext comes with two options of installation, one can either go throught the traditional “gcc” way (configure->make->make install) or the “python” way (python setup.py build->install).
 
Let us look at the second one first, the building process would have gone smoothly as long as your remove the out-of-date pkgc_version_check to be found at line-89 and the import of Overrides to be found at line-103 (don’t know if it’s a good idea though). It will generate correctly the ./gtk/gt(d)kgl/gt(d)kglext.c files but will in most cases be blocked by an attribute error some time later as the dsextra.py has undertaken some big changes ever since the release of our beloved package. Two solutions are nevertheless proposed, but are both somewhat, say, arduous.
1. Overwrite the dsextra.py with one of an older version (that is, to find something that dates back to no late than 2004)
2. Modify the pygtkglext setup.py file to cope with the CVS HEAD changes to dsextra.py. Basically, you want to add ‘install_data’: PyGtkInstallData to the cmdclass dictionary, and move the calls to add_template_option to a class derived from InstallData. (found here)
 

It might just be time for us to revert to the old school way…
First, you need to be sure that you have added the following to your environmental variables:
export PYTHON = path_to_your_python.exe (using ‘/’ and not ‘\’)
export PYGTK_CODEGEN = path to gtk-2.0/codegen/codegen.py (using ‘/’ and not ‘\’)
It is recommended to install it under Python2x/Lib/site-packages just as the others, this can be achieved by providing prefix=python_path/Lib while executing ./configure
Just don’t press enter yet, you have to also link in the python interpreter, the overall command will look like:
./configure –prefix=’C:/Python27/Lib’ LDFLAGS=’-L/c/Python27/libs -lpython27′ and this would suffice for the configuration…
 
For some reason, the make process fails when generating the gt(d)kglext.c files. Luckily we already had the setup.py provide them for us.
So just copy the file into the right folder and pursue the process.
 
Finally, before launching make install you need to replace the ‘\’ with ‘/’ at line-176 and 177 (concerning pyexecdir and pythondir) of the two Makefile(s) found in ./gtk/gt(d)kgl.
 
Now you have successfully installed pygtkglext1, but it wouldn’t work just yet.
Starting from python2.5a1, extension modules with the file extension ‘.dll’ can no longer be imported using a single ‘import’ statement. As a result, the DLL files created during the final step could not be used directly. Now take a look at the source folder, the building step that we initiated long ago (with setup.py) has created for us just what we need. The .pyd files found under ./build/lib.win32-2.x/gtk/gt(d)kgl are almost the same as .dll except that it has a initialization function and that it could be directly ‘imported’ by the others.


Tags: , ,

Posted 16/03/2012 by Tao in category "Uncategorized

Leave a Reply