Skip to content

Commit bc28f93

Browse files
committed
GH#134 Remove some old cruft wrt getting gl/opengl but still handle oserrors
1 parent 55037b8 commit bc28f93

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

OpenGL/platform/glx.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""GLX (x-windows)-specific platform features"""
2+
23
import ctypes, ctypes.util
34
from OpenGL.platform import baseplatform, ctypesloader
45

@@ -11,22 +12,16 @@ class GLXPlatform(baseplatform.BasePlatform):
1112
# references to GL/GLU functions).
1213
@baseplatform.lazy_property
1314
def GL(self):
14-
try:
15-
for name in ('OpenGL', 'GL'):
15+
for name in ('OpenGL', 'GL'):
16+
try:
1617
lib = ctypesloader.loadLibrary(
1718
ctypes.cdll, name, mode=ctypes.RTLD_GLOBAL
1819
)
19-
if lib:
20-
return lib
21-
raise ImportError("Unable to find an OpenGL or GL library")
22-
except OSError as err:
23-
try:
24-
# libGL was the original name, older devices likely still need it...
25-
return ctypesloader.loadLibrary(
26-
ctypes.cdll, "GL", mode=ctypes.RTLD_GLOBAL
27-
)
2820
except OSError as err:
29-
raise ImportError("Unable to load OpenGL library", *err.args)
21+
lib = None
22+
if lib:
23+
return lib
24+
raise ImportError("Unable to load OpenGL or GL library")
3025

3126
@baseplatform.lazy_property
3227
def GLU(self):

tests/test_checks.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,20 @@ def test_x():
7474
"Test did not produce output: %s",
7575
stderr.decode('utf-8', errors='ignore'),
7676
)
77-
raise RuntimeError('Test script failure')
77+
raise RuntimeError('Test script failure on %s' % (func.__name__))
7878
if 'SKIP' in lines:
79-
raise pytest.skip("Skipped by executable")
79+
raise pytest.skip("Skipped by executable on %s" % (func.__name__))
8080
elif 'OK' in lines:
8181
return
8282
else:
8383
log.error(
84-
"Failing check script output: %s",
84+
"Failing check script stderr: %s",
8585
stderr.decode('utf-8', errors='ignore'),
8686
)
87-
print(output)
87+
log.error(
88+
"Failing check script stdout: %s",
89+
output,
90+
)
8891
raise RuntimeError("Test Failed")
8992

9093
return test_x

0 commit comments

Comments
 (0)