Created
November 20, 2016 12:39
-
-
Save torbjo/c2ccc681adff2ec73b57a819d963cf5d to your computer and use it in GitHub Desktop.
Python 3 patch for glitter-0.1.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur glitter-0.1.7/glitter/contexts/textures.py glitter-0.1.7-python3/glitter/contexts/textures.py | |
--- glitter-0.1.7/glitter/contexts/textures.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/contexts/textures.py 2016-11-20 13:15:18.448297416 +0100 | |
@@ -10,12 +10,6 @@ | |
from glitter.utils import BindableObject, GlitterError | |
from glitter.contexts.proxies import BindingProxy | |
-try: | |
- next | |
-except NameError: | |
- def next(iterator): | |
- return iterator.next() | |
- | |
class TextureUnit(BindableObject): | |
"""Proxy for a texture unit. | |
diff -ur glitter-0.1.7/glitter/convenience/clinterop.py glitter-0.1.7-python3/glitter/convenience/clinterop.py | |
--- glitter-0.1.7/glitter/convenience/clinterop.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/convenience/clinterop.py 2016-11-20 13:15:18.476297564 +0100 | |
@@ -25,12 +25,12 @@ | |
"""Returns an OpenGL context. Options: g(lut), q(t)""" | |
if "g" == option[0]: | |
if flag_clinterop_verbose: | |
- print "Creating GLUT context." | |
+ print("Creating GLUT context.") | |
from glitter.contexts.glut import GlutWindow | |
gl_context = GlutWindow(shape=(1, 1), hide=True) | |
elif "q" == option[0]: | |
if flag_clinterop_verbose: | |
- print "Creating QT context." | |
+ print("Creating QT context.") | |
from glitter.contexts.qt import QtWidget | |
from PySide import QtGui | |
app = QtGui.QApplication.instance() | |
diff -ur glitter-0.1.7/glitter/raw/errcheck.py glitter-0.1.7-python3/glitter/raw/errcheck.py | |
--- glitter-0.1.7/glitter/raw/errcheck.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/raw/errcheck.py 2016-11-20 13:15:18.368296995 +0100 | |
@@ -57,6 +57,7 @@ | |
def errcheck(result, func, arguments): | |
error = errcheck_func() | |
+ return result # XXX | |
if error == errcheck_ok: | |
return result | |
else: | |
diff -ur glitter-0.1.7/glitter/raw/glew.py glitter-0.1.7-python3/glitter/raw/glew.py | |
--- glitter-0.1.7/glitter/raw/glew.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/raw/glew.py 2016-11-20 13:15:18.368296995 +0100 | |
@@ -102,7 +102,7 @@ | |
GL_TEXTURE_COMPRESSED = 34465 # Variable c_int '34465' | |
GL_PIXEL_PACK_BUFFER_BINDING_EXT = 35053 # Variable c_int '35053' | |
GL_IMAGE_1D_EXT = 36940 # Variable c_int '36940' | |
-GL_ALL_BARRIER_BITS = 4294967295L # Variable c_uint '4294967295u' | |
+GL_ALL_BARRIER_BITS = 4294967295 # Variable c_uint '4294967295u' | |
GL_RGBA32UI = 36208 # Variable c_int '36208' | |
GL_SOURCE2_ALPHA_EXT = 34186 # Variable c_int '34186' | |
GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = 33884 # Variable c_int '33884' | |
@@ -123,7 +123,7 @@ | |
GL_EYE_DISTANCE_TO_LINE_SGIS = 33266 # Variable c_int '33266' | |
GL_TEXTURE21_ARB = 34005 # Variable c_int '34005' | |
GL_PATH_DASH_CAPS_NV = 36987 # Variable c_int '36987' | |
-GL_TIMEOUT_IGNORED = 18446744073709551615L # Variable c_ulong '-1ul' | |
+GL_TIMEOUT_IGNORED = 18446744073709551615 # Variable c_ulong '-1ul' | |
GL_RGBA8UI_EXT = 36220 # Variable c_int '36220' | |
GL_PATH_COORD_COUNT_NV = 37022 # Variable c_int '37022' | |
GL_SAMPLER_1D_ARRAY_EXT = 36288 # Variable c_int '36288' | |
@@ -1260,7 +1260,7 @@ | |
GL_BLEND_DST_RGB_EXT = 32968 # Variable c_int '32968' | |
GL_INTENSITY16_SNORM = 36891 # Variable c_int '36891' | |
GL_MATRIX24_ARB = 35032 # Variable c_int '35032' | |
-GL_ALL_SHADER_BITS = 4294967295L # Variable c_uint '4294967295u' | |
+GL_ALL_SHADER_BITS = 4294967295 # Variable c_uint '4294967295u' | |
GL_DRAW_BUFFER14_ARB = 34867 # Variable c_int '34867' | |
GL_TEXTURE_BINDING_1D = 32872 # Variable c_int '32872' | |
GL_ARB_map_buffer_range = 1 # Variable c_int '1' | |
@@ -2018,7 +2018,7 @@ | |
GL_VERTEX_ARRAY_TYPE = 32891 # Variable c_int '32891' | |
GL_MAP1_VERTEX_ATTRIB8_4_NV = 34408 # Variable c_int '34408' | |
GL_STENCIL_INDEX16 = 36169 # Variable c_int '36169' | |
-GL_CLIENT_ALL_ATTRIB_BITS = 4294967295L # Variable c_uint '4294967295u' | |
+GL_CLIENT_ALL_ATTRIB_BITS = 4294967295 # Variable c_uint '4294967295u' | |
GL_VALIDATE_STATUS = 35715 # Variable c_int '35715' | |
GL_RG16 = 33324 # Variable c_int '33324' | |
GL_RGB_SCALE_ARB = 34163 # Variable c_int '34163' | |
@@ -2042,7 +2042,7 @@ | |
GL_ACTIVE_ATTRIBUTES = 35721 # Variable c_int '35721' | |
GL_ONE_MINUS_CONSTANT_COLOR_EXT = 32770 # Variable c_int '32770' | |
GL_NV_geometry_program4 = 1 # Variable c_int '1' | |
-GL_TEXCOORD4_BIT_PGI = 2147483648L # Variable c_uint '2147483648u' | |
+GL_TEXCOORD4_BIT_PGI = 2147483648 # Variable c_uint '2147483648u' | |
GL_NORMAL_ARRAY_POINTER_EXT = 32911 # Variable c_int '32911' | |
GL_MAX_ASYNC_DRAW_PIXELS_SGIX = 33632 # Variable c_int '33632' | |
GL_PROXY_COLOR_TABLE = 32979 # Variable c_int '32979' | |
@@ -2216,7 +2216,7 @@ | |
GL_RED_SNORM = 36752 # Variable c_int '36752' | |
GL_PROGRAM_ERROR_POSITION_ARB = 34379 # Variable c_int '34379' | |
GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = 34546 # Variable c_int '34546' | |
-GL_INVALID_INDEX = 4294967295L # Variable c_uint '4294967295u' | |
+GL_INVALID_INDEX = 4294967295 # Variable c_uint '4294967295u' | |
GL_DOUBLE_MAT3x2_EXT = 36683 # Variable c_int '36683' | |
GL_OFFSET_TEXTURE_2D_MATRIX_NV = 34529 # Variable c_int '34529' | |
GL_SAMPLE_COVERAGE_VALUE_ARB = 32938 # Variable c_int '32938' | |
@@ -3560,7 +3560,7 @@ | |
GL_CONVOLUTION_HEIGHT_EXT = 32793 # Variable c_int '32793' | |
GL_MATRIX2_NV = 34354 # Variable c_int '34354' | |
GL_PROXY_TEXTURE_3D = 32880 # Variable c_int '32880' | |
-GL_ALL_BARRIER_BITS_EXT = 4294967295L # Variable c_uint '4294967295u' | |
+GL_ALL_BARRIER_BITS_EXT = 4294967295 # Variable c_uint '4294967295u' | |
GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = 34081 # Variable c_int '34081' | |
GL_UNIFORM_BUFFER_BINDING = 35368 # Variable c_int '35368' | |
GL_UNIFORM_TYPE = 35383 # Variable c_int '35383' | |
diff -ur glitter-0.1.7/glitter/raw/gl.py glitter-0.1.7-python3/glitter/raw/gl.py | |
--- glitter-0.1.7/glitter/raw/gl.py 2014-04-11 11:24:40.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/raw/gl.py 2016-11-20 13:15:18.368296995 +0100 | |
@@ -1695,7 +1695,7 @@ | |
GL_BYTE = 5120 # Variable c_int '5120' | |
GL_BOOL_VEC3 = 35672 # Variable c_int '35672' | |
GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 37064 # Variable c_int '37064' | |
-GL_TIMEOUT_IGNORED = 18446744073709551615L # Variable c_ulonglong '-1ull' | |
+GL_TIMEOUT_IGNORED = 18446744073709551615 # Variable c_ulonglong '-1ull' | |
GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 36485 # Variable c_int '36485' | |
GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070 # Variable c_int '34070' | |
GL_MAX_VARYING_VECTORS = 36348 # Variable c_int '36348' | |
@@ -1724,7 +1724,7 @@ | |
GL_FRONT_LEFT = 1024 # Variable c_int '1024' | |
GL_INVALID_ENUM = 1280 # Variable c_int '1280' | |
GL_TEXTURE_BINDING_2D_MULTISAMPLE = 37124 # Variable c_int '37124' | |
-GL_ALL_SHADER_BITS = 4294967295L # Variable c_uint '4294967295u' | |
+GL_ALL_SHADER_BITS = 4294967295 # Variable c_uint '4294967295u' | |
GL_COMPRESSED_RGBA = 34030 # Variable c_int '34030' | |
GL_TRIANGLE_STRIP_ADJACENCY = 13 # Variable c_int '13' | |
GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 37588 # Variable c_int '37588' | |
@@ -1939,7 +1939,7 @@ | |
GL_POLYGON_MODE = 2880 # Variable c_int '2880' | |
GL_ONE_MINUS_SRC_ALPHA = 771 # Variable c_int '771' | |
GL_SAMPLER_2D_RECT_SHADOW = 35684 # Variable c_int '35684' | |
-GL_ALL_BARRIER_BITS = 4294967295L # Variable c_uint '4294967295u' | |
+GL_ALL_BARRIER_BITS = 4294967295 # Variable c_uint '4294967295u' | |
GL_MAX_TESS_PATCH_COMPONENTS = 36484 # Variable c_int '36484' | |
GL_PROXY_TEXTURE_2D_MULTISAMPLE = 37121 # Variable c_int '37121' | |
GL_TEXTURE31 = 34015 # Variable c_int '34015' | |
@@ -2520,7 +2520,7 @@ | |
GL_RG16 = 33324 # Variable c_int '33324' | |
GL_ACTIVE_ATTRIBUTES = 35721 # Variable c_int '35721' | |
GL_MAX_COMBINED_IMAGE_UNIFORMS = 37071 # Variable c_int '37071' | |
-GL_INVALID_INDEX = 4294967295L # Variable c_uint '4294967295u' | |
+GL_INVALID_INDEX = 4294967295 # Variable c_uint '4294967295u' | |
GL_INT_IMAGE_1D_ARRAY = 36957 # Variable c_int '36957' | |
GL_STENCIL_CLEAR_VALUE = 2961 # Variable c_int '2961' | |
GL_SAMPLE_MASK_VALUE = 36434 # Variable c_int '36434' | |
diff -ur glitter-0.1.7/glitter/raw/glx.py glitter-0.1.7-python3/glitter/raw/glx.py | |
--- glitter-0.1.7/glitter/raw/glx.py 2014-04-11 11:24:47.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/raw/glx.py 2016-11-20 13:15:18.368296995 +0100 | |
@@ -119,7 +119,7 @@ | |
GLX_MAX_PBUFFER_HEIGHT_SGIX = 32791 # Variable c_int '32791' | |
GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX = 4 # Variable c_int '4' | |
GLX_TEXTURE_2D_BIT_EXT = 2 # Variable c_int '2' | |
-GLX_DONT_CARE = 4294967295L # Variable c_uint '4294967295u' | |
+GLX_DONT_CARE = 4294967295 # Variable c_uint '4294967295u' | |
GLX_SGIX_swap_barrier = 1 # Variable c_int '1' | |
GLX_STATIC_COLOR_EXT = 32773 # Variable c_int '32773' | |
GLX_SWAP_METHOD_OML = 32864 # Variable c_int '32864' | |
diff -ur glitter-0.1.7/glitter/raw/logger.py glitter-0.1.7-python3/glitter/raw/logger.py | |
--- glitter-0.1.7/glitter/raw/logger.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/raw/logger.py 2016-11-20 13:15:18.308296680 +0100 | |
@@ -19,16 +19,21 @@ | |
setattr(self, key, getattr(func, key)) | |
def _format_arg(self, x): | |
- if hasattr(x, "_type_") and hasattr(x, "__len__") and hasattr(x, "__getitem__"): | |
- return "%s[%s]" % (x._type_.__name__, ", ".join(self._format_arg(a) for a in x)) | |
- elif hasattr(x, "value"): | |
- return "%s(%r)" % (x.__class__.__name__, x.value) | |
- elif hasattr(x, "contents"): | |
- return "&%s" % self._format_arg(x.contents) | |
- elif hasattr(x, "_name"): | |
- return x._name | |
- else: | |
- return repr(x) | |
+ try: | |
+ if hasattr(x, "_type_") and hasattr(x, "__len__") and hasattr(x, "__getitem__"): | |
+ return "%s[%s]" % (x._type_.__name__, ", ".join(self._format_arg(a) for a in x)) | |
+ elif hasattr(x, "value"): | |
+ return "%s(%r)" % (x.__class__.__name__, x.value) | |
+ elif hasattr(x, "contents"): | |
+ return "&%s" % self._format_arg(x.contents) | |
+ elif hasattr(x, "_name"): | |
+ return x._name | |
+ else: | |
+ return repr(x) | |
+ # When x is an NULL pointer, then hasattr(x, 'contents') | |
+ # raises ValueError('NULL pointer access') | |
+ except ValueError as ex: | |
+ return str(ex) + ' : ' + repr(x) | |
def _format_args(self, args, kwargs): | |
return ", ".join([self._format_arg(x) for x in args] + ["%s=%s" % (k, self._format_arg(v)) for (k, v) in list(kwargs.items())]) | |
diff -ur glitter-0.1.7/glitter/raw/nv.py glitter-0.1.7-python3/glitter/raw/nv.py | |
--- glitter-0.1.7/glitter/raw/nv.py 2014-04-11 11:15:21.000000000 +0200 | |
+++ glitter-0.1.7-python3/glitter/raw/nv.py 2016-11-20 13:15:18.368296995 +0100 | |
@@ -3,8 +3,8 @@ | |
@author: Kai Ruhl | |
@since: 2013-02""" | |
-import glew as _glew | |
-import gl as _gl | |
+from . import glew as _glew | |
+from . import gl as _gl | |
def get_nv_memory_total(): | |
@@ -24,5 +24,5 @@ | |
if __name__ == "__main__": | |
from glitter.contexts.glut import GlutWindow | |
gl_context = GlutWindow(shape=(1, 1), hide=True) | |
- print "Total GPU memory: %d MB" % (get_nv_memory_total()) | |
- print "Available GPU memory: %d MB" % (get_nv_memory_avail()) | |
+ print("Total GPU memory: %d MB" % (get_nv_memory_total())) | |
+ print("Available GPU memory: %d MB" % (get_nv_memory_avail())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://pypi.python.org/pypi/glitter/0.1.7
The documentation says:
That almost worked. I had to do some minor tweaking to get it to run on Python 3.