When installing PyOpenGL 2.0.0.44 from source on my
Debian Linux system, it did not set the file
permissions correctly Directories had the correct
permission, in general, as did compiled files.
The problem probably stems from the fact that my umask
was 077 while building the package (but 022 while
installing.) The installation procedure should never be
umask dependent; directories and shared objects should
be installed 0755 (or 0555) by default, and .py files
(and their compiled and optimize-compiled versions)
should be 0644 (or 0444).
The problem caused built files to be unreadable for
others than root, causing an ImportError when doing
'import OpenGL.GL' (and others) but not 'import
OpenGL'. (and others) because
<prefix>/site-packages/OpenGL/__init__.pyc was
readable, allowing import of that package, but
<prefix>/site-packages/OpenGL/GL/__init___.so (required
by its __init__.pyc) was not readable.
Logged In: YES
user_id=34901
I'm not a unix geek, nor am I a distutils guru, so I'm going
to have to ask for some help here. Basically, the
build_py.py module is likely what's creating wrong modes for
the python files (no idea what's setting the permissions for
the .pyc, .pyo, and .so files).
Base distutils calculates the mode with:
mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777
mode = (os.stat(outfile)[ST_MODE]) | 0111
There's no notes from Tarn regarding why he was using this,
so I can't give any insight on whether it would fail to add
in the &, though I _think_ the & 07777 will just truncate to
"a valid mode number" (unless there's another whole
group-type I'm missing).
So, anyone know:
1) Where in distutils to apply pressure to change .so
permissions
2) Whether there would be any problems on Unix-oid OSes
setting mode to 0644 for python files regardless of their
source-file-permissions? (I'm assuming not for now, given
Thomas expertise).
Logged In: YES
user_id=34901
Is this still causing a problem in the 2.0.1 series?
Logged In: YES
user_id=34209
No, it's still not quite working. The problem is still that
files retain the permissions they were built with, and that
would be too restrictive when built with umask of '077' of
'007', which any security-minded person would have. :-)
Unfortunately, I can't quite figure out where in the
distutils configuration the actual copying is done. There is
some specialcasing of .py files that have '#!' as their
first two bytes (in build_py.py:copy_file()) but it only
sets the execute bits, not the read bits, and it only does
its work for 'scripts', not other .py files (which it
should) and not for .so files (which it should.) And I'm not
a distutils guru either :)
The quick and easy fix is to add 'os.umask(022)' at the top
of setup.py.