2424#undef WITH_THREAD
2525#endif
2626
27- #if defined(BUILD_STATIC )
27+ #if 1 // defined(BUILD_STATIC)
2828#undef import_pygame_base
2929#undef import_pygame_rect
3030#undef import_pygame_surface
3333#undef import_pygame_bufferproxy
3434#undef import_pygame_rwobject
3535#undef import_pygame_event
36+ #undef import_pygame_imageext
37+ #undef import_pygame_image
38+ #undef import_pygame_font
3639
3740void
3841import_pygame_base (void )
3942{
43+ puts ("import_pygame_base" );
4044}
4145
4246void
4347import_pygame_rect (void )
4448{
49+ puts ("import_pygame_rect" );
4550}
4651
4752void
4853import_pygame_surface (void )
4954{
55+ puts ("import_pygame_surface" );
56+ }
57+
58+
59+ void
60+ import_pygame_window (void )
61+ {
62+ puts ("import_pygame_window" );
5063}
5164
5265void
5366import_pygame_geometry (void )
5467{
68+ puts ("import_pygame_geometry" );
5569}
5670
5771void
5872import_pygame_color (void )
5973{
74+ puts ("import_pygame_color" );
75+ }
76+
77+ void
78+ import_pygame_font (void )
79+ {
80+ puts ("import_pygame_font" );
6081}
6182
83+ void
84+ import_pygame_freetype (void )
85+ {
86+ puts ("import_pygame_freetype" );
87+ }
88+
89+
6290void
6391import_pygame_bufferproxy (void )
6492{
93+ puts ("import_pygame_bufferproxy" );
6594}
6695
6796void
6897import_pygame_rwobject (void )
6998{
99+ puts ("import_pygame_rwobject" );
70100}
71101
72102void
73103import_pygame_event (void )
74104{
105+ puts ("import_pygame_event" );
75106}
76107
77108void
78109import_pygame_joystick (void )
79110{
111+ puts ("import_pygame_joystick" );
80112}
81113
82- void
83- import_pygame_window (void )
84- {
85- }
86114
87115PyMODINIT_FUNC
88116PyInit_base (void );
@@ -198,24 +226,28 @@ void
198226load_submodule (const char * parent , PyObject * mod , const char * alias )
199227{
200228 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-
207229 if (!mod ) {
208- snprintf (fqn , sizeof (fqn ), "ERROR: %s .%s" , parent , alias );
230+ snprintf (fqn , sizeof (fqn ), "ERROR: PyInit_%s failed for %s .%s" , alias , parent , alias );
209231 puts (fqn );
210232 PyErr_Print ();
211233 PyErr_Clear ();
212234 }
213235 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 );
236+ snprintf (fqn , sizeof (fqn ), "%s.%s" , parent , alias );
237+ puts (fqn );
238+ PyObject * modules = PyImport_GetModuleDict ();
239+
240+ PyObject * pmod = PyDict_GetItemString (modules , parent );
241+ if (!pmod ) {
242+ snprintf (fqn , sizeof (fqn ), "ERROR: Parent %s not found for %s.%s" , parent , parent , alias );
243+ puts (fqn );
244+ } else {
245+ PyDict_SetItemString (modules , fqn , mod );
246+ PyDict_SetItemString (PyModule_GetDict (mod ), "__name__" ,
247+ PyUnicode_FromString (fqn ));
248+ PyModule_AddObjectRef (pmod , alias , mod );
249+ Py_XDECREF (mod );
250+ }
219251 }
220252}
221253
@@ -225,6 +257,7 @@ load_submodule_mphase(const char *parent, PyObject *mdef, PyObject *spec,
225257{
226258 char fqn [1024 ];
227259 snprintf (fqn , sizeof (fqn ), "%s.%s" , parent , alias );
260+ puts (fqn );
228261 PyObject * modules = PyImport_GetModuleDict ();
229262
230263 Py_DECREF (PyObject_GetAttrString (spec , "name" ));
@@ -255,7 +288,10 @@ load_submodule_mphase(const char *parent, PyObject *mdef, PyObject *spec,
255288static PyObject *
256289mod_pygame_import_cython (PyObject * self , PyObject * spec )
257290{
291+ #if 1 //PY_VERSION_HEX <= 0x030C0000
292+
258293 load_submodule_mphase ("pygame._sdl2" , PyInit_sdl2 (), spec , "sdl2" );
294+
259295 load_submodule_mphase ("pygame._sdl2" , PyInit_mixer (), spec , "mixer" );
260296#if defined(CONTROLLER_NOPYX )
261297 load_submodule ("pygame._sdl2" , PyInit_controller (), "controller" );
@@ -265,7 +301,7 @@ mod_pygame_import_cython(PyObject *self, PyObject *spec)
265301#endif
266302 load_submodule_mphase ("pygame._sdl2" , PyInit_audio (), spec , "audio" );
267303 load_submodule_mphase ("pygame._sdl2" , PyInit_video (), spec , "video" );
268-
304+ #endif
269305 Py_RETURN_NONE ;
270306}
271307
@@ -288,47 +324,74 @@ PyInit_pygame_static()
288324 SDL_SetHint ("SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" , "1" );
289325
290326 load_submodule ("pygame" , PyInit_base (), "base" );
327+
328+ //
291329 load_submodule ("pygame" , PyInit_constants (), "constants" );
292- load_submodule ("pygame" , PyInit_surflock (), "surflock" );
293- load_submodule ("pygame" , PyInit_rwobject (), "rwobject" );
330+ //
294331 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" );
299332
333+ // base, pygame.colordict
334+ load_submodule ("pygame" , PyInit_color (), "color" );
335+
336+ // base
300337 load_submodule ("pygame" , PyInit_rect (), "rect" );
338+
339+ // base, rect
301340 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" );
305341
306- load_submodule ("pygame" , PyInit_imageext (), "imageext" );
342+ load_submodule ("pygame" , PyInit_bufferproxy (), "bufferproxy" );
343+ load_submodule ("pygame" , PyInit_surflock (), "surflock" );
307344
345+ // base, color, rect, bufferproxy, surflock
346+ load_submodule ("pygame" , PyInit_surface (), "surface" );
347+
348+ load_submodule ("pygame" , PyInit_rwobject (), "rwobject" );
349+
350+ // base, color, rect, bufferproxy, surflock, surface, rwobject
351+ load_submodule ("pygame" , PyInit_imageext (), "imageext" );
352+ // base, color, rect, bufferproxy, surflock, surface, rwobject
308353 load_submodule ("pygame" , PyInit_image (), "image" );
354+
355+ load_submodule ("pygame" , PyInit__freetype (), "_freetype" );
309356 load_submodule ("pygame" , PyInit_font (), "font" );
310357 load_submodule ("pygame" , PyInit_pixelcopy (), "pixelcopy" );
311358 load_submodule ("pygame" , PyInit_newbuffer (), "newbuffer" );
312359
313- load_submodule ("pygame" , PyInit_color (), "color" );
314- load_submodule ("pygame" , PyInit_bufferproxy (), "bufferproxy" );
360+ // base
361+ load_submodule ("pygame" , PyInit_joystick (), "joystick" );
362+ // base, joystick
363+ load_submodule ("pygame" , PyInit_event (), "event" );
364+
365+ // base, rect, event
366+ load_submodule ("pygame" , PyInit_key (), "key" );
367+ // base, event
368+ load_submodule ("pygame" , PyInit_pg_time (), "time" );
369+
315370
316371 load_submodule ("pygame" , PyInit_transform (), "transform" );
317372 load_submodule ("pygame" , PyInit_draw (), "draw" );
318373
319374 load_submodule ("pygame" , PyInit_mask (), "mask" );
320375 load_submodule ("pygame" , PyInit_mouse (), "mouse" );
321- load_submodule ("pygame" , PyInit_event (), "event" );
322- load_submodule ("pygame" , PyInit_joystick (), "joystick" );
376+
323377
324378 load_submodule ("pygame" , PyInit_pg_mixer (), "mixer" );
325379 load_submodule ("pygame.mixer" , PyInit_mixer_music (), "music" );
326380
381+ // base, color, rect, bufferproxy, surflock, surface
327382 load_submodule ("pygame" , PyInit_window (), "window" );
383+
384+ // base, color, rect, surflock, surface, window
385+ load_submodule ("pygame" , PyInit_display (), "display" );
328386 load_submodule ("pygame" , PyInit__render (), "_render" );
329387
330388 load_submodule ("pygame" , PyInit_pixelarray (), "pixelarray" );
331389
390+ // base, color, rect, bufferproxy, surflock, surface
391+ load_submodule ("pygame" , PyInit_gfxdraw (), "gfxdraw" );
392+
393+ //load_submodule("pygame", PyInit_system(), "system");
394+
332395 return PyModule_Create (& mod_pygame_static );
333396}
334397
0 commit comments