Commits

Anonymous committed b8cded4

remove old python support

Comments (0)

Files changed (11)

 # BREAK = change breaks existing code
 # BUG	= fixed a bug that was (or could have been) crashing
 
+November 18, 2003
+    Remove legacy python code. Ver 2.2 is minimum
+
 pygame-16
 October 23, 2003
     final updates for 1.6
            calls the update method for all sprites in the group.
            Passes all arguments on to the Sprite update function."""
         if args:
-            a=apply
             for s in self.spritedict.keys():
-                a(s.update, args)
+                s.update(*args)
         else:
             for s in self.spritedict.keys():
                 s.update()
 
     def update(self, *args):
         if self.sprite:
-            apply(self.sprite.update, args)
+            self.sprite.update(*args)
 
     def __nonzero__(self):
         return self.sprite is not 0
 releases. (hmm, until we get to versions > 10)
 """
 
-ver =   '1.6'
-vernum = 1,6
+ver =   '1.6.1'
+vernum = 1,6,1
 <font size=+5><b>Pygame Readme</b></font>
 </td></tr><tr><td align=left width=33%><big>
 
-Version 1.6<br>October 23, 2003
+Version 1.6.1<br>Devel Release
 
 
 </td><td align=center width=34%><big>
 
 METADATA = {
     "name":             "pygame",
-    "version":          "1.6",
+    "version":          "1.6.1",
     "license":          "LGPL",
     "url":              "http://www.pygame.org",
     "author":           "Pete Shinners",
     "long_description": DESCRIPTION,
 }
 
-try:
-    import distutils
-except ImportError:
-    raise SystemExit, "Pygame requires distutils to build and install."
+import sys
+if not hasattr(sys, 'version_info') or sys.version_info < (2,2):
+    raise SystemExit, "Pygame requires Python version 2.2 or above."
 
 
 #get us to the correct directory
 }
 
 
-#if PY_MAJOR_VERSION >= 2 && PY_MINOR_VERSION >= 2
-#define DO_CRASH_TRACEBACK
 
 #include<pystate.h>
 #include<compile.h>
 	    tb = next;
     }
 }
-#endif
-
 
 
 /*error signal handlers (replacing SDL parachute)*/
 static void pygame_parachute(int sig)
 {
 	char* signaltype;
-#ifdef DO_CRASH_TRACEBACK
 	PyThreadState* thread;
 	PyInterpreterState *interp;
 	int thread_id;
-#endif
 
 	signal(sig, SIG_DFL);
 	switch (sig)
 	}
 
 
-#ifdef DO_CRASH_TRACEBACK
 	printf("Pygame Parachute Traceback:\n");
 	interp = PyInterpreterState_Head();
 	thread=PyInterpreterState_ThreadHead(interp);
 	    Py_INCREF(thread->curexc_traceback);
 	    print_traceback(thread->curexc_traceback);
 	}
-#else
-	printf("  (No Traceback Without Python2.2)\n");
-#endif
 
 	atexit_quit();
 	Py_FatalError(signaltype);
 	DEC_CONST(JOYBUTTONDOWN);
 	DEC_CONST(JOYBUTTONUP);
 	DEC_CONST(VIDEORESIZE);
-#if SDL_VERSIONNUM(1, 2, 2) <= SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
 	DEC_CONST(VIDEOEXPOSE);
-#else
-	PyModule_AddIntConstant(module, "VIDEOEXPOSE", 0);
-#endif
 	DEC_CONST(QUIT);
 	DEC_CONST(SYSWMEVENT);
 	DEC_CONST(USEREVENT);
 #include <SDL.h>
 
 
-/* older python compatability */
-#if PYTHON_API_VERSION < 1009
-#define PyObject_DEL(op)		free(op)
-#define PyMem_New(type, n)  	((type*)PyMem_Malloc((n) * sizeof(type)))
-#define PyMem_Del(p)			PyMem_Free((char*)p)
-static int PyModule_AddObject(PyObject *m, char *name, PyObject *o)
-{
-	PyObject *dict;
-    if (!PyModule_Check(m) || o == NULL)
-		return -1;
-	dict = PyModule_GetDict(m);
-	if (dict == NULL)
-		return -1;
-    if (PyDict_SetItemString(dict, name, o))
-		return -1;
-	Py_DECREF(o);
-	return 0;
-}
-#define PyModule_AddIntConstant(m, name, value) \
-	PyModule_AddObject(m, name, PyInt_FromLong(value))
-#define PyString_AsStringAndSize(o,ppc,pn) (*ppc = PyString_AsString(o), *pn = PyString_Size(o))
-#define PySequence_Size(x) PySequence_Length(x)
-
-#define PyUnicode_Check(text) 0
-#endif
 
 /* macros used throughout the source */
 #define RAISE(x,y) (PyErr_SetString((x), (y)), (PyObject*)NULL)
 staticforward PyTypeObject PyRect_Type;
 #define PyRect_Check(x) ((x)->ob_type == &PyRect_Type)
 
-#if PYTHON_API_VERSION >= 1011 /*this is the python-2.2 constructor*/
 static PyObject* rect_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
-#endif
 
 
 
 
 	/* Space for future expansion */
 	0L,0L,0L,
-#if PYTHON_API_VERSION >= 1011 /*PYTHON2.2*/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */
-#else
-	0,					/* tp_flags */
-#endif
 	doc_Rect_MODULE,    /* Documentation string */
-#if PYTHON_API_VERSION >= 1011 /*PYTHON2.2*/
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
 	0,					/* tp_richcompare */
 	0,					/* tp_init */
 	0,					/* tp_alloc */
 	rect_new,			/* tp_new */
-#endif
 };
 
 
 
 /*module globals*/
-
+#if 0
     /*DOC*/ static char doc_Rect[] =
     /*DOC*/    "pygame.Rect(rectstyle) -> Rect\n"
     /*DOC*/    "create a new rectangle\n"
     /*DOC*/    "version of those functions. They effect the actual\n"
     /*DOC*/    "source object, instead of returning a new Rect object.\n"
     /*DOC*/ ;
+#endif
 
-static PyObject* RectInit(PyObject* self, PyObject* args)
+
+static PyObject* rect_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	GAME_Rect *argrect, temp;
 	if(!(argrect = GameRect_FromObject(args, &temp)))
 }
 
 
-#if PYTHON_API_VERSION >= 1011 /*this is the python-2.2 constructor*/
-static PyObject* rect_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-	GAME_Rect *argrect, temp;
-	if(!(argrect = GameRect_FromObject(args, &temp)))
-		return RAISE(PyExc_TypeError, "Argument must be rect style object");
-
-	return PyRect_New4(argrect->x, argrect->y, argrect->w, argrect->h);
-}
-#endif
-
-
 static PyMethodDef rect__builtins__[] =
 {
-#if PYTHON_API_VERSION < 1011 /*PYTHON2.2*/
-	{ "Rect", RectInit, 1, doc_Rect },
-#endif
 	{NULL, NULL}
 };
 
 	dict = PyModule_GetDict(module);
 
 	PyDict_SetItemString(dict, "RectType", (PyObject *)&PyRect_Type);
-#if PYTHON_API_VERSION >= 1011 /*this is the python-2.2 constructor*/
 	PyDict_SetItemString(dict, "Rect", (PyObject *)&PyRect_Type);
-#endif
 
 	/* export the c api */
 	c_api[0] = &PyRect_Type;
 extern int pygame_AlphaBlit(SDL_Surface *src, SDL_Rect *srcrect,
                         SDL_Surface *dst, SDL_Rect *dstrect);
 
-#if PYTHON_API_VERSION >= 1011 /*this is the python-2.2 constructor*/
 static PyObject* surface_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
-#endif
 
 
 
 	return PyString_FromString(str);
 }
 
-#if PYTHON_API_VERSION < 1011 /*PYTHON2.2*/
+#if 0
     /*DOC*/ static char doc_Surface_MODULE[] =
     /*DOC*/    "Surface objects represent a simple memory buffer of pixels.\n"
     /*DOC*/    "Surface objects can reside in system memory, or in special\n"
 static PyTypeObject PySurface_Type =
 {
 	PyObject_HEAD_INIT(NULL)
-	0,						/*size*/
-	"Surface",				/*name*/
-	sizeof(PySurfaceObject),/*basic size*/
-	0,						/*itemsize*/
-	surface_dealloc,		/*dealloc*/
-	0,						/*print*/
+	0,                              /*size*/
+	"Surface",                      /*name*/
+	sizeof(PySurfaceObject),        /*basic size*/
+	0,                              /*itemsize*/
+	surface_dealloc,                /*dealloc*/
+	0,                              /*print*/
 	surface_getattr,		/*getattr*/
-	NULL,					/*setattr*/
-	NULL,					/*compare*/
+	NULL,                           /*setattr*/
+	NULL,                           /*compare*/
 	surface_str,			/*repr*/
-	NULL,					/*as_number*/
-	NULL,					/*as_sequence*/
-	NULL,					/*as_mapping*/
+	NULL,                           /*as_number*/
+	NULL,                           /*as_sequence*/
+	NULL,                           /*as_mapping*/
 	(hashfunc)NULL, 		/*hash*/
 	(ternaryfunc)NULL,		/*call*/
 	(reprfunc)NULL, 		/*str*/
 	0L,0L,0L,
-#if PYTHON_API_VERSION >= 1011 /*PYTHON2.2*/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */
 	doc_Surface, /* Documentation string */
-#else
-	0,					/* tp_flags */
-	doc_Surface_MODULE, /* Documentation string */
-#endif
-#if PYTHON_API_VERSION >= 1011 /*PYTHON2.2*/
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
 	0,					/* tp_richcompare */
 	0,					/* tp_init */
 	0,					/* tp_alloc */
 	surface_new,		/* tp_new */
-#endif
 };
 
 
 	return final;
 }
 
-#if PYTHON_API_VERSION >= 1011 /*this is the python-2.2 constructor*/
 static PyObject* surface_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
 	return Surface(NULL, args);
 }
-#endif
 
 
 
 
 static PyMethodDef surface_builtins[] =
 {
-#if PYTHON_API_VERSION < 1011 /*PYTHON2.2*/
-	{ "Surface", Surface, 1, doc_Surface },
-#endif
 	{ NULL, NULL }
 };
 
 	dict = PyModule_GetDict(module);
 
 	PyDict_SetItemString(dict, "SurfaceType", (PyObject *)&PySurface_Type);
-#if PYTHON_API_VERSION >= 1011 /*this is the python-2.2 constructor*/
 	PyDict_SetItemString(dict, "Surface", (PyObject *)&PySurface_Type);
-#endif
 
 	/* export the c api */
 	c_api[0] = &PySurface_Type;
 	PySurface_Unlock(lifelock->surface);
 	Py_DECREF(lifelock->surface);
 
-	PyObject_DEL(self);	
+	PyObject_DEL(self);
 }
 
 static PyTypeObject PyLifetimeLock_Type =
 {
 	PyObject_HEAD_INIT(NULL)
-	0,						     /*size*/
+	0,                           /*size*/
 	"SurfLifeLock",              /*name*/
 	sizeof(PyLifetimeLockObject),/*basic size*/
-	0,						     /*itemsize*/
-	lifelock_dealloc,		     /*dealloc*/
+	0,                           /*itemsize*/
+	lifelock_dealloc,            /*dealloc*/
 };