471,616 Members | 1,315 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,616 software developers and data experts.

PyOpenGL without SetupTools

Hi,
I am distributing a package with a precompiled collection of modules
and packages useful for Python based medical/biological/astronomical
image analysis and algorithm development. (Codename: Priithon).
For Priithon I put all modules/packages in a simple / single directory
(tree) including one starting batch/script file. This script sets up
PYTHONPATH to find modules at this place.
It works fine for Windows,Linux and Mac-OSX.

Now I want to upgrade everything to Python 2.5 and thought it might
be time get PyOpengl version 3 (aka. pyOpengl-ctypes).

The problem at hand is now that PyOpenGL uses "all this setup-tools
machinery" just to initialize the formathandlers for the different
ways to deal with arrays. (I really need only numpy support !)
This is done via the pkg_resources mechanism called "entry_points".

Can I include a simple non-system-install of pkg_resources that makes
at least the entry_point stuff work ? Where do I put pyOpenGL's
"entry_points.txt" file ?

Thanks,
Sebastian Haase
MDC Berlin

Oct 1 '07 #1
2 2130
On Oct 1, 4:04 am, seb.ha...@gmail.com wrote:
Hi,
I am distributing a package with a precompiled collection of modules
and packages useful for Python based medical/biological/astronomical
image analysis and algorithm development. (Codename: Priithon).
For Priithon I put all modules/packages in a simple / single directory
(tree) including one starting batch/script file. This script sets up
PYTHONPATH to find modules at this place.
It works fine for Windows,Linux and Mac-OSX.

Now I want to upgrade everything to Python 2.5 and thought it might
be time get PyOpengl version 3 (aka. pyOpengl-ctypes).

The problem at hand is now that PyOpenGL uses "all this setup-tools
machinery" just to initialize the formathandlers for the different
ways to deal with arrays. (I really need only numpy support !)
This is done via the pkg_resources mechanism called "entry_points".

Can I include a simple non-system-install of pkg_resources that makes
at least the entry_point stuff work ? Where do I put pyOpenGL's
"entry_points.txt" file ?

The simple answer is "don't bother with PyOpenGL-ctypes if you don't
have to". Besides the hassles with binary packaging, it's quite a bit
slower then PyOpenGL 2.0.

Anyways, when I saw that I couldn't easily figure out how to register
a setuptools package by hand (the point you seem to be at now), I
resorted to using the same hack that setuptools uses to register its
packages. Setuptools puts a pth file, something like
"ezsetup_XXXX.pth", in the site-packages directory. The file has a
couple lines of Python code that mark the start and end of the eggs on
sys.path; then they call setuptools to postprocess and register the
eggs.

What I did was to duplicate the effect of these lines in my main
script. I don't have it in front of me, but it was something along
these lines:

sys.__eggindex = len(sys.path)
sys.path.append("OpenGL-cytpes-3.0.0a7-whatever.egg")
setuptools.register_packages()

I copied the OpenGL egg to my distro directory, and it worked.

Another possibility is to do it the "setuptools" way: by not packaging
PyOpenGL 3.0 at all, and instead marking it as a dependency. Then,
setuptools will helpfully download it for the user. (Personally, I
hate that scripts can recklessly download and install stuff into your
site packages without even asking; seems like a possible security hole
as well.) But it's an option.

Carl Banks

Oct 1 '07 #2


Are there PyOpenGL 2.0 (I guess 2.0.1.09 is goood) binaries available
for Python 2.5 ? Anywhere ?

Thanks for the reply

-Sebastian Haase

On Oct 1, 11:49 am, Carl Banks <pavlovevide...@gmail.comwrote:
On Oct 1, 4:04 am, seb.ha...@gmail.com wrote:
Hi,
I am distributing a package with a precompiled collection of modules
and packages useful for Python based medical/biological/astronomical
image analysis and algorithm development. (Codename: Priithon).
For Priithon I put all modules/packages in a simple / single directory
(tree) including one starting batch/script file. This script sets up
PYTHONPATH to find modules at this place.
It works fine for Windows,Linux and Mac-OSX.
Now I want to upgrade everything to Python 2.5 and thought it might
be time get PyOpengl version 3 (aka. pyOpengl-ctypes).
The problem at hand is now that PyOpenGL uses "all this setup-tools
machinery" just to initialize the formathandlers for the different
ways to deal with arrays. (I really need only numpy support !)
This is done via the pkg_resources mechanism called "entry_points".
Can I include a simple non-system-install of pkg_resources that makes
at least the entry_point stuff work ? Where do I put pyOpenGL's
"entry_points.txt" file ?

The simple answer is "don't bother with PyOpenGL-ctypes if you don't
have to". Besides the hassles with binary packaging, it's quite a bit
slower then PyOpenGL 2.0.

Anyways, when I saw that I couldn't easily figure out how to register
a setuptools package by hand (the point you seem to be at now), I
resorted to using the same hack that setuptools uses to register its
packages. Setuptools puts a pth file, something like
"ezsetup_XXXX.pth", in the site-packages directory. The file has a
couple lines of Python code that mark the start and end of the eggs on
sys.path; then they call setuptools to postprocess and register the
eggs.

What I did was to duplicate the effect of these lines in my main
script. I don't have it in front of me, but it was something along
these lines:

sys.__eggindex = len(sys.path)
sys.path.append("OpenGL-cytpes-3.0.0a7-whatever.egg")
setuptools.register_packages()

I copied the OpenGL egg to my distro directory, and it worked.

Another possibility is to do it the "setuptools" way: by not packaging
PyOpenGL 3.0 at all, and instead marking it as a dependency. Then,
setuptools will helpfully download it for the user. (Personally, I
hate that scripts can recklessly download and install stuff into your
site packages without even asking; seems like a possible security hole
as well.) But it's an option.

Carl Banks

Oct 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Erik Max Francis | last post: by
1 post views Thread by Ilias Lazaridis | last post: by
5 posts views Thread by Sébastien Ramage | last post: by
reply views Thread by sweetmelon | last post: by
reply views Thread by Calvin Spealman | last post: by
7 posts views Thread by Thorsten Kampe | last post: by
reply views Thread by =?ISO-8859-1?Q?S=E9bastien_Ramage?= | last post: by
reply views Thread by Colin J. Williams | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.