PyOpenGL-accelerate 4.0.0a4__tar.gz → 4.0.0a5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/OpenGL_accelerate/__init__.py +1 -1
  2. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/PKG-INFO +18 -2
  3. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/PyOpenGL_accelerate.egg-info/PKG-INFO +18 -2
  4. pyopengl_accelerate-4.0.0a5/PyOpenGL_accelerate.egg-info/requires.txt +1 -0
  5. pyopengl_accelerate-4.0.0a5/README.md +31 -0
  6. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/setup.py +96 -6
  7. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/pygl_runtime.c +9 -4
  8. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/vbo.pyx +6 -2
  9. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/tests/test_arraydatatypeaccel.py +17 -8
  10. pyopengl_accelerate-4.0.0a4/PyOpenGL_accelerate.egg-info/requires.txt +0 -1
  11. pyopengl_accelerate-4.0.0a4/README.md +0 -15
  12. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/MANIFEST.in +0 -0
  13. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/OpenGL_accelerate/formathandler.pxd +0 -0
  14. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/OpenGL_accelerate/wrapper.pxd +0 -0
  15. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/PyOpenGL_accelerate.egg-info/SOURCES.txt +0 -0
  16. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/PyOpenGL_accelerate.egg-info/dependency_links.txt +0 -0
  17. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/PyOpenGL_accelerate.egg-info/top_level.txt +0 -0
  18. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/license.txt +0 -0
  19. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/pyproject.toml +0 -0
  20. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/setup.cfg +0 -0
  21. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/arraydatatype.pyx +0 -0
  22. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/buffers_formathandler.pyx +0 -0
  23. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_EGL.c +0 -0
  24. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_GL.c +0 -0
  25. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_GLES1.c +0 -0
  26. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_GLES2.c +0 -0
  27. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_GLES3.c +0 -0
  28. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_GLSC2.c +0 -0
  29. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_GLX.c +0 -0
  30. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_WGL.c +0 -0
  31. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_generated.c +0 -0
  32. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/generated/pygl_modules.c +0 -0
  33. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/c/pygl_handwritten.c +0 -0
  34. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/errorchecker.pyx +0 -0
  35. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/formathandler.pyx +0 -0
  36. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/latebind.pyx +0 -0
  37. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/nones_formathandler.pyx +0 -0
  38. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/numpy_formathandler.pyx +0 -0
  39. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/src/wrapper.pyx +0 -0
  40. {pyopengl_accelerate-4.0.0a4 → pyopengl_accelerate-4.0.0a5}/tests/test_numpyaccel.py +0 -0
@@ -7,5 +7,5 @@ PyOpenGL package and is built via the setupaccel.py
7
7
  script in the top level of the PyOpenGL source package.
8
8
  """
9
9
 
10
- __version__ = "4.0.0a4"
10
+ __version__ = "4.0.0a5"
11
11
  __version_tuple__ = (4, 0, 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOpenGL-accelerate
3
- Version: 4.0.0a4
3
+ Version: 4.0.0a5
4
4
  Summary: Cython-coded accelerators for PyOpenGL
5
5
  Home-page: http://pyopengl.sourceforge.net
6
6
  Download-URL: http://sourceforge.net/project/showfiles.php?group_id=5988
@@ -24,7 +24,7 @@ Classifier: Intended Audience :: Developers
24
24
  Requires-Python: >=3.9
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: license.txt
27
- Requires-Dist: PyOpenGL==4.0.0a4
27
+ Requires-Dist: PyOpenGL==4.0.0a5
28
28
  Dynamic: download-url
29
29
  Dynamic: license-file
30
30
  Dynamic: requires-dist
@@ -35,6 +35,22 @@ This set of C (Cython) extensions provides acceleration of common operations
35
35
  for slow points in PyOpenGL 3.x. It is not a requirement for using PyOpenGL
36
36
  but performance without it will be poor.
37
37
 
38
+ ## The PyOpenGL it pairs with
39
+
40
+ `PyOpenGL_accelerate` and `PyOpenGL` are released together, carry the same
41
+ version number, and have to be equal. They share the dispatch extension's
42
+ generated tables, where the slot numbering of one release is meaningless to
43
+ another, so this package requires the exact `PyOpenGL` it was built against:
44
+
45
+ pip install PyOpenGL PyOpenGL_accelerate
46
+
47
+ Installing or upgrading `PyOpenGL_accelerate` brings the matching `PyOpenGL`
48
+ with it. Upgrading `PyOpenGL` on its own does not go the other way — it leaves
49
+ the older accelerate installed — so name both packages when you upgrade either.
50
+ A pair that has come apart is refused when the first entry point is built, in a
51
+ message naming both versions; `PYOPENGL_USE_ACCELERATE=0` in the environment
52
+ runs on ctypes until it is put right.
53
+
38
54
  ## Build Process
39
55
 
40
56
  Cython is updated frequently to support newer versions of Python. As of
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOpenGL-accelerate
3
- Version: 4.0.0a4
3
+ Version: 4.0.0a5
4
4
  Summary: Cython-coded accelerators for PyOpenGL
5
5
  Home-page: http://pyopengl.sourceforge.net
6
6
  Download-URL: http://sourceforge.net/project/showfiles.php?group_id=5988
@@ -24,7 +24,7 @@ Classifier: Intended Audience :: Developers
24
24
  Requires-Python: >=3.9
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: license.txt
27
- Requires-Dist: PyOpenGL==4.0.0a4
27
+ Requires-Dist: PyOpenGL==4.0.0a5
28
28
  Dynamic: download-url
29
29
  Dynamic: license-file
30
30
  Dynamic: requires-dist
@@ -35,6 +35,22 @@ This set of C (Cython) extensions provides acceleration of common operations
35
35
  for slow points in PyOpenGL 3.x. It is not a requirement for using PyOpenGL
36
36
  but performance without it will be poor.
37
37
 
38
+ ## The PyOpenGL it pairs with
39
+
40
+ `PyOpenGL_accelerate` and `PyOpenGL` are released together, carry the same
41
+ version number, and have to be equal. They share the dispatch extension's
42
+ generated tables, where the slot numbering of one release is meaningless to
43
+ another, so this package requires the exact `PyOpenGL` it was built against:
44
+
45
+ pip install PyOpenGL PyOpenGL_accelerate
46
+
47
+ Installing or upgrading `PyOpenGL_accelerate` brings the matching `PyOpenGL`
48
+ with it. Upgrading `PyOpenGL` on its own does not go the other way — it leaves
49
+ the older accelerate installed — so name both packages when you upgrade either.
50
+ A pair that has come apart is refused when the first entry point is built, in a
51
+ message naming both versions; `PYOPENGL_USE_ACCELERATE=0` in the environment
52
+ runs on ctypes until it is put right.
53
+
38
54
  ## Build Process
39
55
 
40
56
  Cython is updated frequently to support newer versions of Python. As of
@@ -0,0 +1 @@
1
+ PyOpenGL==4.0.0a5
@@ -0,0 +1,31 @@
1
+ # Acceleration code for PyOpenGL
2
+
3
+ This set of C (Cython) extensions provides acceleration of common operations
4
+ for slow points in PyOpenGL 3.x. It is not a requirement for using PyOpenGL
5
+ but performance without it will be poor.
6
+
7
+ ## The PyOpenGL it pairs with
8
+
9
+ `PyOpenGL_accelerate` and `PyOpenGL` are released together, carry the same
10
+ version number, and have to be equal. They share the dispatch extension's
11
+ generated tables, where the slot numbering of one release is meaningless to
12
+ another, so this package requires the exact `PyOpenGL` it was built against:
13
+
14
+ pip install PyOpenGL PyOpenGL_accelerate
15
+
16
+ Installing or upgrading `PyOpenGL_accelerate` brings the matching `PyOpenGL`
17
+ with it. Upgrading `PyOpenGL` on its own does not go the other way — it leaves
18
+ the older accelerate installed — so name both packages when you upgrade either.
19
+ A pair that has come apart is refused when the first entry point is built, in a
20
+ message naming both versions; `PYOPENGL_USE_ACCELERATE=0` in the environment
21
+ runs on ctypes until it is put right.
22
+
23
+ ## Build Process
24
+
25
+ Cython is updated frequently to support newer versions of Python. As of
26
+ release 3.1.9 we no longer check in the Cython generated code for the
27
+ wrapper modules, relying on the build machines to generate the wrappers.
28
+
29
+ The Github CI Pipeline should generate and release binary builds for most
30
+ major platforms (Windows, Linux, Mac), but if you need to build from source,
31
+ a `pip install .` **should** work from the PyOpenGL repository.
@@ -53,6 +53,42 @@ def pyopengl_requirement():
53
53
  return 'PyOpenGL==%s' % (_our_version(),)
54
54
 
55
55
 
56
+ VERSION_HEADER = 'src/c/generated/pygl_version.h'
57
+
58
+
59
+ def write_version_header():
60
+ """State the version in a header, and answer where it was written.
61
+
62
+ The extension reports at import which PyOpenGL its tables came from, so
63
+ that number has to reach the C. A ``-D`` on the command line would too,
64
+ but a compiler driver's flags are not something the build compares against
65
+ an object file it already has: bump the version, and the existing
66
+ ``pygl_runtime.o`` is still newer than every source and header, so it is
67
+ linked as it stands and the new build announces the old version. A header
68
+ is compared, being in ``depends``, so a bump recompiles what includes it.
69
+
70
+ Rewritten only when the contents change, so an unchanged version does not
71
+ invalidate the objects on every build.
72
+ """
73
+ path = os.path.join(HERE, VERSION_HEADER)
74
+ contents = (
75
+ '/* Written by accelerate\'s setup.py from OpenGL_accelerate.__version__.\n'
76
+ ' * The pair is released together and carries one number, so this is\n'
77
+ ' * the PyOpenGL whose generated tables this extension holds. */\n'
78
+ '#define PYOPENGL_VERSION "%s"\n' % (_our_version(),)
79
+ )
80
+ try:
81
+ with open(path, encoding='utf-8') as handle:
82
+ if handle.read() == contents:
83
+ return VERSION_HEADER
84
+ except OSError:
85
+ pass
86
+ os.makedirs(os.path.dirname(path), exist_ok=True)
87
+ with open(path, 'w', encoding='utf-8') as handle:
88
+ handle.write(contents)
89
+ return VERSION_HEADER
90
+
91
+
56
92
  def dispatch_extension():
57
93
  """The registry-generated C implementation of the OpenGL entry points.
58
94
 
@@ -94,18 +130,16 @@ def dispatch_extension():
94
130
  'src/c/pygl.h',
95
131
  'src/c/generated/pygl_elements.h',
96
132
  'src/c/generated/pygl_glgets.h',
133
+ # Says which PyOpenGL these tables were generated from, so that a
134
+ # mismatched pair is refused with a sentence rather than dispatching
135
+ # through the wrong slot indices.
136
+ write_version_header(),
97
137
  ]
98
138
  return [
99
139
  Extension(
100
140
  'OpenGL_accelerate.dispatch',
101
141
  sources=sources,
102
142
  include_dirs=['src/c', 'src/c/generated'],
103
- # The extension states which PyOpenGL its tables were generated
104
- # from, so that a mismatched pair is refused with a sentence rather
105
- # than dispatching through the wrong slot indices. The two are
106
- # released together and carry the same number, so this is the
107
- # accelerate version.
108
- define_macros=[('PYOPENGL_VERSION', '"%s"' % (_our_version(),))],
109
143
  depends=[
110
144
  path for path in headers if os.path.exists(os.path.join(HERE, path))
111
145
  ],
@@ -121,6 +155,58 @@ def dispatch_extension():
121
155
  extensions.extend(dispatch_extension())
122
156
 
123
157
 
158
+ #: Where the toolchain the generated C was written against is recorded.
159
+ TOOLCHAIN_STAMP = os.path.join(HERE, 'src', '.cython-toolchain')
160
+
161
+
162
+ def _toolchain():
163
+ """Cython and numpy as the generated C sees them: version strings.
164
+
165
+ numpy is in here because these modules ``cimport numpy``, and what that
166
+ expands to is numpy's own declarations rather than anything in this
167
+ package.
168
+ """
169
+ from Cython import __version__ as cython_version
170
+
171
+ try:
172
+ from numpy import __version__ as numpy_version
173
+ except ImportError: # the numpy extension is skipped
174
+ numpy_version = 'none'
175
+ return 'cython %s\nnumpy %s\n' % (cython_version, numpy_version)
176
+
177
+
178
+ def drop_c_from_another_toolchain():
179
+ """Delete generated C that a different Cython or numpy wrote.
180
+
181
+ ``cythonize`` decides whether to rewrite a ``.c`` by comparing it against
182
+ the ``.pyx`` and the ``.pxd`` files that ``.pyx`` cimports. A
183
+ wheel-installed numpy carries the timestamps recorded in the wheel, so its
184
+ declarations can be years older than a ``.c`` generated from a *previous*
185
+ numpy last week -- and the stale C is then compiled against headers that no
186
+ longer match it. What that reports is a compile error inside a numpy
187
+ internal, naming nothing in this package.
188
+
189
+ The generated C is not tracked by git and every ``.pyx`` beside it is
190
+ shipped, so it can always be written again. Only with Cython installed:
191
+ an install from an sdist without one has the C and no way to make more.
192
+ """
193
+ import glob
194
+
195
+ if not have_cython:
196
+ return
197
+ wanted = _toolchain()
198
+ try:
199
+ with open(TOOLCHAIN_STAMP, encoding='utf-8') as handle:
200
+ if handle.read() == wanted:
201
+ return
202
+ except OSError:
203
+ pass
204
+ for path in glob.glob(os.path.join(HERE, 'src', '*.c')):
205
+ os.unlink(path)
206
+ with open(TOOLCHAIN_STAMP, 'w', encoding='utf-8') as handle:
207
+ handle.write(wanted)
208
+
209
+
124
210
  def cython_extension(
125
211
  name,
126
212
  include_dirs=(),
@@ -190,6 +276,10 @@ else:
190
276
  if ( # Prevents running of setup during code introspection imports
191
277
  __name__ == "__main__"
192
278
  ):
279
+ # Here rather than at module level: importing this file is how the suite
280
+ # and the packaging tools read what it declares, and an import that
281
+ # deleted generated C would make reading the declarations a build step.
282
+ drop_c_from_another_toolchain()
193
283
  # Workaround for Broken apple Python build params echoed in distutils
194
284
  # Approach taken from the PyMongo driver. OS-X Python builds were created with
195
285
  # non-existent flag, and distutils passes those flags to the extension
@@ -2864,10 +2864,15 @@ static int pygl_init_errors(void)
2864
2864
  return (pygl_null_function_error && pygl_no_context_error) ? 0 : -1;
2865
2865
  }
2866
2866
 
2867
- /* The PyOpenGL version this extension's tables were generated from, supplied by
2868
- * accelerate's setup.py. Absent only in a build that has not been told, and a
2869
- * build that cannot say which tables it holds is not one to dispatch through --
2870
- * see OpenGL._dispatch._versions_match. */
2867
+ /* The PyOpenGL version this extension's tables were generated from, written by
2868
+ * accelerate's setup.py into generated/pygl_version.h. A build that cannot say
2869
+ * which tables it holds is not one to dispatch through, so an absent header
2870
+ * leaves a version nothing matches -- see OpenGL._dispatch._versions_match. */
2871
+ #if defined(__has_include)
2872
+ # if __has_include("generated/pygl_version.h")
2873
+ # include "generated/pygl_version.h"
2874
+ # endif
2875
+ #endif
2871
2876
  #ifndef PYOPENGL_VERSION
2872
2877
  #define PYOPENGL_VERSION "unknown"
2873
2878
  #endif
@@ -2,7 +2,7 @@
2
2
  #cython: language_level=3
3
3
  import ctypes, weakref
4
4
  from OpenGL_accelerate.formathandler cimport FormatHandler
5
- from OpenGL import error
5
+ from OpenGL import dispatch, error
6
6
  from OpenGL._bytes import bytes,unicode
7
7
  try:
8
8
  long = long
@@ -201,7 +201,11 @@ cdef class VBO:
201
201
  self.get_implementation()._DELETERS_[ id(self) ] = weakref.ref(
202
202
  # Cython instances can't have weakrefs, sigh...
203
203
  self,
204
- self.get_implementation().deleter( [self.buffer], id(self) )
204
+ # With the context the buffer was made in, which is the only one
205
+ # its name means this buffer in; see OpenGL.arrays.vbo.
206
+ self.get_implementation().deleter(
207
+ [self.buffer], id(self), dispatch.context_identity()
208
+ )
205
209
  )
206
210
  return self.buffer
207
211
  def copy_data( self ):
@@ -95,20 +95,29 @@ class TestNumpy( _BaseTest, unittest.TestCase ):
95
95
  z = self.handler.zeros( (0,), GL.GL_BYTE )
96
96
  assert z.dtype == numpy.byte, z
97
97
 
98
+ def two_rows_of_three():
99
+ """Six floats in memory a VBO can be made from without a copy.
100
+
101
+ Where there is no numpy the array is built and filled rather than
102
+ converted from a list: converting one *is* the copy ERROR_ON_COPY refuses,
103
+ and what these cases are about is the VBO handler rather than the way the
104
+ array beside it was made.
105
+ """
106
+ if numpy:
107
+ return numpy.array( [[1,2,3],[4,5,6]], 'f' )
108
+ array = adt.GLfloatArray.zeros( (2,3) )
109
+ array[0][:] = (1.0,2.0,3.0)
110
+ array[1][:] = (4.0,5.0,6.0)
111
+ return array
112
+
98
113
  class TestVBO( _BaseTest, unittest.TestCase ):
99
114
  def setUp( self ):
100
- if numpy:
101
- self.array = vbo.VBO(numpy.array( [[1,2,3],[4,5,6]],'f'))
102
- else:
103
- self.array = vbo.VBO(adt.GLfloatArray.asArray([[1,2,3],[4,5,6]]))
115
+ self.array = vbo.VBO(two_rows_of_three())
104
116
  super(TestVBO,self).setUp()
105
117
 
106
118
  class TestVBOOffset( _BaseTest, unittest.TestCase ):
107
119
  def setUp( self ):
108
- if numpy:
109
- self.array = vbo.VBO(numpy.array( [[1,2,3],[4,5,6]],'f')) + 12
110
- else:
111
- self.array = vbo.VBO(adt.GLfloatArray.asArray([[1,2,3],[4,5,6]])) + 12
120
+ self.array = vbo.VBO(two_rows_of_three()) + 12
112
121
  super(TestVBOOffset,self).setUp()
113
122
 
114
123
  class TestNones( unittest.TestCase ):
@@ -1 +0,0 @@
1
- PyOpenGL==4.0.0a4
@@ -1,15 +0,0 @@
1
- # Acceleration code for PyOpenGL
2
-
3
- This set of C (Cython) extensions provides acceleration of common operations
4
- for slow points in PyOpenGL 3.x. It is not a requirement for using PyOpenGL
5
- but performance without it will be poor.
6
-
7
- ## Build Process
8
-
9
- Cython is updated frequently to support newer versions of Python. As of
10
- release 3.1.9 we no longer check in the Cython generated code for the
11
- wrapper modules, relying on the build machines to generate the wrappers.
12
-
13
- The Github CI Pipeline should generate and release binary builds for most
14
- major platforms (Windows, Linux, Mac), but if you need to build from source,
15
- a `pip install .` **should** work from the PyOpenGL repository.