google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

pyglet fails for sys.platform=='linux3' #571

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. linux 3.x kernel; python compiled with this kernel
2. run: python -c "import pyglet.gl"

Paste in the traceback or error message:

$ python -c "import pyglet.gl"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/src/pyglet/pyglet/gl/__init__.py", line 236, in <module>
    import pyglet.window
  File "/opt/src/pyglet/pyglet/window/__init__.py", line 1811, in <module>
    gl._create_shadow_window()
  File "/opt/src/pyglet/pyglet/gl/__init__.py", line 205, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/opt/src/pyglet/pyglet/window/xlib/__init__.py", line 160, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/opt/src/pyglet/pyglet/window/__init__.py", line 501, in __init__
    gl.Config(double_buffer=True, depth_size=24),
AttributeError: 'module' object has no attribute 'Config'

Original issue reported on code.google.com by rob.mcmu...@gmail.com on 9 Apr 2012 at 9:58

GoogleCodeExporter commented 9 years ago
Most python releases report sys.platform = 'linux3' on a 3.x kernel.  This is 
discussed in http://bugs.python.org/issue12326 and in the dev trunk they 
settled on 'linux2' even on linux 3.x.

But for current python releases, they will report 'linux3' which breaks 
pyglet/gl/__init__.py.  Patch enclosed.

Original comment by rob.mcmu...@gmail.com on 9 Apr 2012 at 10:04

Attachments:

GoogleCodeExporter commented 9 years ago
Just discovered that 'linux2' is listed in lots more places:

$ find . -name "*.py" -exec grep -H linux2 '{}' ';'
./tools/wraptypes/preprocessor.py:            'linux2': ('__gnu_linux__', 
'__linux', '__linux__', 'linux',
./tools/genwrappers.py:    if sys.platform == 'linux2':
./experimental/input/input.py:elif sys.platform == 'linux2':
./experimental/wxtest.py:elif sys.platform == 'linux2':
./experimental/wxtest.py:elif sys.platform == 'linux2':
./pyglet/input/__init__.py:    if sys.platform == 'linux2':
./pyglet/image/codecs/__init__.py:    if sys.platform == 'linux2':
./pyglet/lib.py:        if self.platform == 'linux2':
./pyglet/lib.py:elif sys.platform == 'linux2':
./pyglet/media/drivers/openal/__init__.py:        if sys.platform in ('darwin', 
'linux2'):
./tests/image/PLATFORM_RGBA_LOAD.py:if sys.platform == 'linux2':
./tests/image/PLATFORM_RGB_LOAD.py:if sys.platform == 'linux2':
./tests/image/PLATFORM_LA_LOAD.py:if sys.platform == 'linux2':
./tests/image/PLATFORM_L_LOAD.py:if sys.platform == 'linux2':
./tests/test.py:        'linux2': 'X11',

Original comment by rob.mcmu...@gmail.com on 9 Apr 2012 at 10:36

GoogleCodeExporter commented 9 years ago
I've (hopefully) fixed all platform strings in rev. 233eab46e8b2.
Everything seems to work fine with Python 3.3.0a2+ build on Linux 3.3 where 
sys.platform is just "linux".

Original comment by andreas....@gmail.com on 14 Apr 2012 at 1:13