@@ -49,6 +49,11 @@ import_pygame_surface(void)
49
49
{
50
50
}
51
51
52
+ void
53
+ import_pygame_window (void )
54
+ {
55
+ }
56
+
52
57
void
53
58
import_pygame_geometry (void )
54
59
{
@@ -59,6 +64,16 @@ import_pygame_color(void)
59
64
{
60
65
}
61
66
67
+ void
68
+ import_pygame_font (void )
69
+ {
70
+ }
71
+
72
+ void
73
+ import_pygame_freetype (void )
74
+ {
75
+ }
76
+
62
77
void
63
78
import_pygame_bufferproxy (void )
64
79
{
@@ -79,8 +94,22 @@ import_pygame_joystick(void)
79
94
{
80
95
}
81
96
97
+ #undef import_pygame_imageext
98
+ #undef import_pygame_render
99
+ #undef import_pygame_pixelarray
100
+
82
101
void
83
- import_pygame_window (void )
102
+ import_pygame_imageext (void )
103
+ {
104
+ }
105
+
106
+ void
107
+ import_pygame_render (void )
108
+ {
109
+ }
110
+
111
+ void
112
+ import_pygame_pixelarray (void )
84
113
{
85
114
}
86
115
@@ -198,24 +227,30 @@ void
198
227
load_submodule (const char * parent , PyObject * mod , const char * alias )
199
228
{
200
229
char fqn [1024 ];
201
- snprintf (fqn , sizeof (fqn ), "%s.%s" , parent , alias );
202
-
203
- PyObject * modules = PyImport_GetModuleDict ();
204
-
205
- PyObject * pmod = PyDict_GetItemString (modules , parent );
206
-
207
230
if (!mod ) {
208
- snprintf (fqn , sizeof (fqn ), "ERROR: %s.%s" , parent , alias );
231
+ snprintf (fqn , sizeof (fqn ), "ERROR: PyInit_%s failed for %s.%s" , alias ,
232
+ parent , alias );
209
233
puts (fqn );
210
234
PyErr_Print ();
211
235
PyErr_Clear ();
212
236
}
213
237
else {
214
- PyDict_SetItemString (modules , fqn , mod );
215
- PyDict_SetItemString (PyModule_GetDict (mod ), "__name__" ,
216
- PyUnicode_FromString (fqn ));
217
- PyModule_AddObjectRef (pmod , alias , mod );
218
- Py_XDECREF (mod );
238
+ snprintf (fqn , sizeof (fqn ), "%s.%s" , parent , alias );
239
+ PyObject * modules = PyImport_GetModuleDict ();
240
+
241
+ PyObject * pmod = PyDict_GetItemString (modules , parent );
242
+ if (!pmod ) {
243
+ snprintf (fqn , sizeof (fqn ), "ERROR: Parent %s not found for %s.%s" ,
244
+ parent , parent , alias );
245
+ puts (fqn );
246
+ }
247
+ else {
248
+ PyDict_SetItemString (modules , fqn , mod );
249
+ PyDict_SetItemString (PyModule_GetDict (mod ), "__name__" ,
250
+ PyUnicode_FromString (fqn ));
251
+ PyModule_AddObjectRef (pmod , alias , mod );
252
+ Py_XDECREF (mod );
253
+ }
219
254
}
220
255
}
221
256
@@ -225,6 +260,7 @@ load_submodule_mphase(const char *parent, PyObject *mdef, PyObject *spec,
225
260
{
226
261
char fqn [1024 ];
227
262
snprintf (fqn , sizeof (fqn ), "%s.%s" , parent , alias );
263
+
228
264
PyObject * modules = PyImport_GetModuleDict ();
229
265
230
266
Py_DECREF (PyObject_GetAttrString (spec , "name" ));
@@ -256,6 +292,7 @@ static PyObject *
256
292
mod_pygame_import_cython (PyObject * self , PyObject * spec )
257
293
{
258
294
load_submodule_mphase ("pygame._sdl2" , PyInit_sdl2 (), spec , "sdl2" );
295
+
259
296
load_submodule_mphase ("pygame._sdl2" , PyInit_mixer (), spec , "mixer" );
260
297
#if defined(CONTROLLER_NOPYX )
261
298
load_submodule ("pygame._sdl2" , PyInit_controller (), "controller" );
@@ -288,47 +325,72 @@ PyInit_pygame_static()
288
325
SDL_SetHint ("SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" , "1" );
289
326
290
327
load_submodule ("pygame" , PyInit_base (), "base" );
328
+
329
+ //
291
330
load_submodule ("pygame" , PyInit_constants (), "constants" );
292
- load_submodule ("pygame" , PyInit_surflock (), "surflock" );
293
- load_submodule ("pygame" , PyInit_rwobject (), "rwobject" );
331
+ //
294
332
load_submodule ("pygame" , PyInit_pg_math (), "math" );
295
- load_submodule ("pygame" , PyInit_display (), "display" );
296
- load_submodule ("pygame" , PyInit_surface (), "surface" );
297
- load_submodule ("pygame" , PyInit_system (), "system" );
298
- load_submodule ("pygame" , PyInit_key (), "key" );
299
333
334
+ // base, pygame.colordict
335
+ load_submodule ("pygame" , PyInit_color (), "color" );
336
+
337
+ // base
300
338
load_submodule ("pygame" , PyInit_rect (), "rect" );
339
+
340
+ // base, rect
301
341
load_submodule ("pygame" , PyInit_geometry (), "geometry" );
302
- load_submodule ("pygame" , PyInit_gfxdraw (), "gfxdraw" );
303
- load_submodule ("pygame" , PyInit_pg_time (), "time" );
304
- load_submodule ("pygame" , PyInit__freetype (), "_freetype" );
305
342
306
- load_submodule ("pygame" , PyInit_imageext (), "imageext" );
343
+ load_submodule ("pygame" , PyInit_bufferproxy (), "bufferproxy" );
344
+ load_submodule ("pygame" , PyInit_surflock (), "surflock" );
345
+
346
+ // base, color, rect, bufferproxy, surflock
347
+ load_submodule ("pygame" , PyInit_surface (), "surface" );
348
+
349
+ load_submodule ("pygame" , PyInit_rwobject (), "rwobject" );
307
350
351
+ // base, color, rect, bufferproxy, surflock, surface, rwobject
352
+ load_submodule ("pygame" , PyInit_imageext (), "imageext" );
353
+ // base, color, rect, bufferproxy, surflock, surface, rwobject
308
354
load_submodule ("pygame" , PyInit_image (), "image" );
355
+
356
+ load_submodule ("pygame" , PyInit__freetype (), "_freetype" );
309
357
load_submodule ("pygame" , PyInit_font (), "font" );
310
358
load_submodule ("pygame" , PyInit_pixelcopy (), "pixelcopy" );
311
359
load_submodule ("pygame" , PyInit_newbuffer (), "newbuffer" );
312
360
313
- load_submodule ("pygame" , PyInit_color (), "color" );
314
- load_submodule ("pygame" , PyInit_bufferproxy (), "bufferproxy" );
361
+ // base
362
+ load_submodule ("pygame" , PyInit_joystick (), "joystick" );
363
+ // base, joystick
364
+ load_submodule ("pygame" , PyInit_event (), "event" );
365
+
366
+ // base, rect, event
367
+ load_submodule ("pygame" , PyInit_key (), "key" );
368
+ // base, event
369
+ load_submodule ("pygame" , PyInit_pg_time (), "time" );
315
370
316
371
load_submodule ("pygame" , PyInit_transform (), "transform" );
317
372
load_submodule ("pygame" , PyInit_draw (), "draw" );
318
373
319
374
load_submodule ("pygame" , PyInit_mask (), "mask" );
320
375
load_submodule ("pygame" , PyInit_mouse (), "mouse" );
321
- load_submodule ("pygame" , PyInit_event (), "event" );
322
- load_submodule ("pygame" , PyInit_joystick (), "joystick" );
323
376
324
377
load_submodule ("pygame" , PyInit_pg_mixer (), "mixer" );
325
378
load_submodule ("pygame.mixer" , PyInit_mixer_music (), "music" );
326
379
380
+ // base, color, rect, bufferproxy, surflock, surface
327
381
load_submodule ("pygame" , PyInit_window (), "window" );
382
+
383
+ // base, color, rect, surflock, surface, window
384
+ load_submodule ("pygame" , PyInit_display (), "display" );
328
385
load_submodule ("pygame" , PyInit__render (), "_render" );
329
386
330
387
load_submodule ("pygame" , PyInit_pixelarray (), "pixelarray" );
331
388
389
+ // base, color, rect, bufferproxy, surflock, surface
390
+ load_submodule ("pygame" , PyInit_gfxdraw (), "gfxdraw" );
391
+
392
+ load_submodule ("pygame" , PyInit_system (), "system" );
393
+
332
394
return PyModule_Create (& mod_pygame_static );
333
395
}
334
396
0 commit comments