diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-10 04:07:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-10 04:07:34 +0400 |
commit | 7440fee85c6d2d4c5854337ae8bf3ed7aea91a50 (patch) | |
tree | 1fdb611fab96ba5e7af468233211722e0ca2bb58 /source/blender/python/generic | |
parent | f71ef0874413d30be6d6e74500aa0a45628b5188 (diff) |
remove python2.x support
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r-- | source/blender/python/generic/BGL.c | 15 | ||||
-rw-r--r-- | source/blender/python/generic/BGL.h | 3 | ||||
-rw-r--r-- | source/blender/python/generic/Geometry.c | 8 | ||||
-rw-r--r-- | source/blender/python/generic/Geometry.h | 2 | ||||
-rw-r--r-- | source/blender/python/generic/Mathutils.c | 15 | ||||
-rw-r--r-- | source/blender/python/generic/Mathutils.h | 6 | ||||
-rw-r--r-- | source/blender/python/generic/bpy_internal_import.c | 8 | ||||
-rw-r--r-- | source/blender/python/generic/bpy_internal_import.h | 1 | ||||
-rw-r--r-- | source/blender/python/generic/euler.c | 6 | ||||
-rw-r--r-- | source/blender/python/generic/euler.h | 1 | ||||
-rw-r--r-- | source/blender/python/generic/matrix.c | 42 | ||||
-rw-r--r-- | source/blender/python/generic/quat.c | 34 | ||||
-rw-r--r-- | source/blender/python/generic/quat.h | 1 | ||||
-rw-r--r-- | source/blender/python/generic/vector.c | 76 | ||||
-rw-r--r-- | source/blender/python/generic/vector.h | 1 |
15 files changed, 11 insertions, 208 deletions
diff --git a/source/blender/python/generic/BGL.c b/source/blender/python/generic/BGL.c index de82781cf3a..2fd9130857f 100644 --- a/source/blender/python/generic/BGL.c +++ b/source/blender/python/generic/BGL.c @@ -83,13 +83,7 @@ static PyObject *Buffer_getattr( PyObject * self, char *name ); static PyObject *Buffer_repr( PyObject * self ); PyTypeObject buffer_Type = { -#if (PY_VERSION_HEX >= 0x02060000) PyVarObject_HEAD_INIT(NULL, 0) -#else - /* python 2.5 and below */ - PyObject_HEAD_INIT( NULL ) /* required py macro */ - 0, /* ob_size */ -#endif "buffer", /*tp_name */ sizeof( Buffer ), /*tp_basicsize */ 0, /*tp_itemsize */ @@ -1090,7 +1084,6 @@ static struct PyMethodDef BGL_methods[] = { {NULL, NULL, 0, NULL} }; -#if (PY_VERSION_HEX >= 0x03000000) static struct PyModuleDef BGL_module_def = { PyModuleDef_HEAD_INIT, "BGL", /* m_name */ @@ -1102,17 +1095,13 @@ static struct PyModuleDef BGL_module_def = { 0, /* m_clear */ 0, /* m_free */ }; -#endif -PyObject *BGL_Init(const char *from) + +PyObject *BGL_Init(void) { PyObject *mod, *dict, *item; -#if (PY_VERSION_HEX >= 0x03000000) mod = PyModule_Create(&BGL_module_def); PyDict_SetItemString(PySys_GetObject("modules"), BGL_module_def.m_name, mod); -#else - mod= Py_InitModule(from, BGL_methods); -#endif dict= PyModule_GetDict(mod); if( PyType_Ready( &buffer_Type) < 0) diff --git a/source/blender/python/generic/BGL.h b/source/blender/python/generic/BGL.h index 938c916bcea..a8c37bf3edd 100644 --- a/source/blender/python/generic/BGL.h +++ b/source/blender/python/generic/BGL.h @@ -42,9 +42,8 @@ #include <Python.h> #include <GL/glew.h> -#include "../intern/bpy_compat.h" -PyObject *BGL_Init( const char *from ); +PyObject *BGL_Init(void); /*@ Buffer Object */ /*@ For Python access to OpenGL functions requiring a pointer. */ diff --git a/source/blender/python/generic/Geometry.c b/source/blender/python/generic/Geometry.c index b4a34d30051..70295d1c2d9 100644 --- a/source/blender/python/generic/Geometry.c +++ b/source/blender/python/generic/Geometry.c @@ -78,7 +78,6 @@ struct PyMethodDef M_Geometry_methods[] = { {NULL, NULL, 0, NULL} }; -#if (PY_VERSION_HEX >= 0x03000000) static struct PyModuleDef M_Geometry_module_def = { PyModuleDef_HEAD_INIT, "Geometry", /* m_name */ @@ -90,19 +89,14 @@ static struct PyModuleDef M_Geometry_module_def = { 0, /* m_clear */ 0, /* m_free */ }; -#endif /*----------------------------MODULE INIT-------------------------*/ -PyObject *Geometry_Init(const char *from) +PyObject *Geometry_Init(void) { PyObject *submodule; -#if (PY_VERSION_HEX >= 0x03000000) submodule = PyModule_Create(&M_Geometry_module_def); PyDict_SetItemString(PySys_GetObject("modules"), M_Geometry_module_def.m_name, submodule); -#else - submodule = Py_InitModule3(from, M_Geometry_methods, M_Geometry_doc); -#endif return (submodule); } diff --git a/source/blender/python/generic/Geometry.h b/source/blender/python/generic/Geometry.h index ebfb054c54a..0e46c0d18db 100644 --- a/source/blender/python/generic/Geometry.h +++ b/source/blender/python/generic/Geometry.h @@ -34,6 +34,6 @@ #include <Python.h> #include "Mathutils.h" -PyObject *Geometry_Init( const char *from ); +PyObject *Geometry_Init(void); #endif /* EXPP_Geometry_H */ diff --git a/source/blender/python/generic/Mathutils.c b/source/blender/python/generic/Mathutils.c index 53077659655..f53fd66ba99 100644 --- a/source/blender/python/generic/Mathutils.c +++ b/source/blender/python/generic/Mathutils.c @@ -94,7 +94,6 @@ struct PyMethodDef M_Mathutils_methods[] = { /*----------------------------MODULE INIT-------------------------*/ /* from can be Blender.Mathutils or GameLogic.Mathutils for the BGE */ -#if (PY_VERSION_HEX >= 0x03000000) static struct PyModuleDef M_Mathutils_module_def = { PyModuleDef_HEAD_INIT, "Mathutils", /* m_name */ @@ -106,21 +105,13 @@ static struct PyModuleDef M_Mathutils_module_def = { 0, /* m_clear */ 0, /* m_free */ }; -#endif -PyObject *Mathutils_Init(const char *from) +PyObject *Mathutils_Init(void) { PyObject *submodule; //seed the generator for the rand function BLI_srand((unsigned int) (PIL_check_seconds_timer() * 0x7FFFFFFF)); - -#if (PY_VERSION_HEX < 0x03000000) - vector_Type.tp_flags |= Py_TPFLAGS_CHECKTYPES; - matrix_Type.tp_flags |= Py_TPFLAGS_CHECKTYPES; - euler_Type.tp_flags |= Py_TPFLAGS_CHECKTYPES; - quaternion_Type.tp_flags |= Py_TPFLAGS_CHECKTYPES; -#endif if( PyType_Ready( &vector_Type ) < 0 ) return NULL; @@ -131,12 +122,8 @@ PyObject *Mathutils_Init(const char *from) if( PyType_Ready( &quaternion_Type ) < 0 ) return NULL; -#if (PY_VERSION_HEX >= 0x03000000) submodule = PyModule_Create(&M_Mathutils_module_def); PyDict_SetItemString(PySys_GetObject("modules"), M_Mathutils_module_def.m_name, submodule); -#else - submodule = Py_InitModule3(from, M_Mathutils_methods, M_Mathutils_doc); -#endif /* each type has its own new() function */ PyModule_AddObject( submodule, "Vector", (PyObject *)&vector_Type ); diff --git a/source/blender/python/generic/Mathutils.h b/source/blender/python/generic/Mathutils.h index 5bdd9d9cfe0..ad67d2e511e 100644 --- a/source/blender/python/generic/Mathutils.h +++ b/source/blender/python/generic/Mathutils.h @@ -32,7 +32,6 @@ #define EXPP_Mathutils_H #include <Python.h> -#include "../intern/bpy_compat.h" #include "vector.h" #include "matrix.h" #include "quat.h" @@ -55,10 +54,7 @@ PyObject *BaseMathObject_getOwner( BaseMathObject * self, void * ); PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void * ); void BaseMathObject_dealloc(BaseMathObject * self); - - - -PyObject *Mathutils_Init( const char * from ); +PyObject *Mathutils_Init(void); PyObject *quat_rotation(PyObject *arg1, PyObject *arg2); diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 073cb58f1c8..05c846b16f5 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -179,20 +179,12 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k PyObject *newmodule; //PyObject_Print(args, stderr, 0); -#if (PY_VERSION_HEX >= 0x02060000) int dummy_val; /* what does this do?*/ static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0}; if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist, &name, &globals, &locals, &fromlist, &dummy_val) ) return NULL; -#else - static char *kwlist[] = {"name", "globals", "locals", "fromlist", 0}; - - if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOO:bpy_import_meth", kwlist, - &name, &globals, &locals, &fromlist ) ) - return NULL; -#endif /* import existing builtin modules or modules that have been imported alredy */ newmodule = PyImport_ImportModuleEx( name, globals, locals, fromlist ); diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h index aeeafb7c1c4..c93d930dab0 100644 --- a/source/blender/python/generic/bpy_internal_import.h +++ b/source/blender/python/generic/bpy_internal_import.h @@ -32,7 +32,6 @@ #define EXPP_bpy_import_h #include <Python.h> -#include "../intern/bpy_compat.h" #include "compile.h" /* for the PyCodeObject */ #include "eval.h" /* for PyEval_EvalCode */ diff --git a/source/blender/python/generic/euler.c b/source/blender/python/generic/euler.c index 69373b1aa36..c6aaee64ebe 100644 --- a/source/blender/python/generic/euler.c +++ b/source/blender/python/generic/euler.c @@ -547,13 +547,7 @@ static PyGetSetDef Euler_getseters[] = { //------------------PY_OBECT DEFINITION-------------------------- PyTypeObject euler_Type = { -#if (PY_VERSION_HEX >= 0x02060000) PyVarObject_HEAD_INIT(NULL, 0) -#else - /* python 2.5 and below */ - PyObject_HEAD_INIT( NULL ) /* required py macro */ - 0, /* ob_size */ -#endif "euler", //tp_name sizeof(EulerObject), //tp_basicsize 0, //tp_itemsize diff --git a/source/blender/python/generic/euler.h b/source/blender/python/generic/euler.h index a3706d53756..74d184fef81 100644 --- a/source/blender/python/generic/euler.h +++ b/source/blender/python/generic/euler.h @@ -32,7 +32,6 @@ #define EXPP_euler_h #include <Python.h> -#include "../intern/bpy_compat.h" extern PyTypeObject euler_Type; #define EulerObject_Check(_v) PyObject_TypeCheck((_v), &euler_Type) diff --git a/source/blender/python/generic/matrix.c b/source/blender/python/generic/matrix.c index 5bdbf804618..d4153243516 100644 --- a/source/blender/python/generic/matrix.c +++ b/source/blender/python/generic/matrix.c @@ -998,8 +998,6 @@ static PySequenceMethods Matrix_SeqMethods = { }; - -#if (PY_VERSION_HEX >= 0x03000000) static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item) { if (PyIndex_Check(item)) { @@ -1071,11 +1069,8 @@ static PyMappingMethods Matrix_AsMapping = { (binaryfunc)Matrix_subscript, (objobjargproc)Matrix_ass_subscript }; -#endif /* (PY_VERSION_HEX >= 0x03000000) */ - -#if (PY_VERSION_HEX >= 0x03000000) static PyNumberMethods Matrix_NumMethods = { (binaryfunc) Matrix_add, /*nb_add*/ (binaryfunc) Matrix_sub, /*nb_subtract*/ @@ -1112,33 +1107,6 @@ static PyNumberMethods Matrix_NumMethods = { 0, /* nb_inplace_true_divide */ 0, /* nb_index */ }; -#else -static PyNumberMethods Matrix_NumMethods = { - (binaryfunc) Matrix_add, /* __add__ */ - (binaryfunc) Matrix_sub, /* __sub__ */ - (binaryfunc) Matrix_mul, /* __mul__ */ - (binaryfunc) 0, /* __div__ */ - (binaryfunc) 0, /* __mod__ */ - (binaryfunc) 0, /* __divmod__ */ - (ternaryfunc) 0, /* __pow__ */ - (unaryfunc) 0, /* __neg__ */ - (unaryfunc) 0, /* __pos__ */ - (unaryfunc) 0, /* __abs__ */ - (inquiry) 0, /* __nonzero__ */ - (unaryfunc) Matrix_inv, /* __invert__ */ - (binaryfunc) 0, /* __lshift__ */ - (binaryfunc) 0, /* __rshift__ */ - (binaryfunc) 0, /* __and__ */ - (binaryfunc) 0, /* __xor__ */ - (binaryfunc) 0, /* __or__ */ - /*(coercion)*/ 0, /* __coerce__ */ - (unaryfunc) 0, /* __int__ */ - (unaryfunc) 0, /* __long__ */ - (unaryfunc) 0, /* __float__ */ - (unaryfunc) 0, /* __oct__ */ - (unaryfunc) 0, /* __hex__ */ -}; -#endif static PyObject *Matrix_getRowSize( MatrixObject * self, void *type ) { @@ -1164,13 +1132,7 @@ static PyGetSetDef Matrix_getseters[] = { /*------------------PY_OBECT DEFINITION--------------------------*/ PyTypeObject matrix_Type = { -#if (PY_VERSION_HEX >= 0x02060000) PyVarObject_HEAD_INIT(NULL, 0) -#else - /* python 2.5 and below */ - PyObject_HEAD_INIT( NULL ) /* required py macro */ - 0, /* ob_size */ -#endif "matrix", /*tp_name*/ sizeof(MatrixObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -1182,11 +1144,7 @@ PyTypeObject matrix_Type = { (reprfunc) Matrix_repr, /*tp_repr*/ &Matrix_NumMethods, /*tp_as_number*/ &Matrix_SeqMethods, /*tp_as_sequence*/ -#if (PY_VERSION_HEX >= 0x03000000) &Matrix_AsMapping, /*tp_as_mapping*/ -#else - 0, -#endif 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ diff --git a/source/blender/python/generic/quat.c b/source/blender/python/generic/quat.c index a353f73c854..e06bee32031 100644 --- a/source/blender/python/generic/quat.c +++ b/source/blender/python/generic/quat.c @@ -620,7 +620,6 @@ static PySequenceMethods Quaternion_SeqMethods = { (ssizessizeobjargproc) Quaternion_ass_slice, /* sq_ass_slice */ }; -#if (PY_VERSION_HEX >= 0x03000000) static PyNumberMethods Quaternion_NumMethods = { (binaryfunc) Quaternion_add, /*nb_add*/ (binaryfunc) Quaternion_sub, /*nb_subtract*/ @@ -657,33 +656,6 @@ static PyNumberMethods Quaternion_NumMethods = { 0, /* nb_inplace_true_divide */ 0, /* nb_index */ }; -#else -static PyNumberMethods Quaternion_NumMethods = { - (binaryfunc) Quaternion_add, /* __add__ */ - (binaryfunc) Quaternion_sub, /* __sub__ */ - (binaryfunc) Quaternion_mul, /* __mul__ */ - (binaryfunc) 0, /* __div__ */ - (binaryfunc) 0, /* __mod__ */ - (binaryfunc) 0, /* __divmod__ */ - (ternaryfunc) 0, /* __pow__ */ - (unaryfunc) 0, /* __neg__ */ - (unaryfunc) 0, /* __pos__ */ - (unaryfunc) 0, /* __abs__ */ - (inquiry) 0, /* __nonzero__ */ - (unaryfunc) 0, /* __invert__ */ - (binaryfunc) 0, /* __lshift__ */ - (binaryfunc) 0, /* __rshift__ */ - (binaryfunc) 0, /* __and__ */ - (binaryfunc) 0, /* __xor__ */ - (binaryfunc) 0, /* __or__ */ - /*(coercion)*/ 0, /* __coerce__ */ - (unaryfunc) 0, /* __int__ */ - (unaryfunc) 0, /* __long__ */ - (unaryfunc) 0, /* __float__ */ - (unaryfunc) 0, /* __oct__ */ - (unaryfunc) 0, /* __hex__ */ -}; -#endif static PyObject *Quaternion_getAxis( QuaternionObject * self, void *type ) { @@ -778,13 +750,7 @@ static PyGetSetDef Quaternion_getseters[] = { //------------------PY_OBECT DEFINITION-------------------------- PyTypeObject quaternion_Type = { -#if (PY_VERSION_HEX >= 0x02060000) PyVarObject_HEAD_INIT(NULL, 0) -#else - /* python 2.5 and below */ - PyObject_HEAD_INIT( NULL ) /* required py macro */ - 0, /* ob_size */ -#endif "quaternion", //tp_name sizeof(QuaternionObject), //tp_basicsize 0, //tp_itemsize diff --git a/source/blender/python/generic/quat.h b/source/blender/python/generic/quat.h index a7cfb7898b1..a1d01b4982d 100644 --- a/source/blender/python/generic/quat.h +++ b/source/blender/python/generic/quat.h @@ -32,7 +32,6 @@ #define EXPP_quat_h #include <Python.h> -#include "../intern/bpy_compat.h" extern PyTypeObject quaternion_Type; #define QuaternionObject_Check(_v) PyObject_TypeCheck((_v), &quaternion_Type) diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c index cf2396b30d4..63bc2fbc7d1 100644 --- a/source/blender/python/generic/vector.c +++ b/source/blender/python/generic/vector.c @@ -1058,21 +1058,11 @@ static PySequenceMethods Vector_SeqMethods = { (binaryfunc) 0, /* sq_concat */ (ssizeargfunc) 0, /* sq_repeat */ (ssizeargfunc) Vector_item, /* sq_item */ -#if (PY_VERSION_HEX < 0x03000000) - (ssizessizeargfunc) Vector_slice, /* sq_slice */ /* PY2 ONLY */ -#else - NULL, -#endif + NULL, /* py3 deprecated slice func */ (ssizeobjargproc) Vector_ass_item, /* sq_ass_item */ -#if (PY_VERSION_HEX < 0x03000000) - (ssizessizeobjargproc) Vector_ass_slice, /* sq_ass_slice */ /* PY2 ONLY */ -#else - NULL, -#endif + NULL, /* py3 deprecated slice assign func */ }; - -#if (PY_VERSION_HEX >= 0x03000000) static PyObject *Vector_subscript(VectorObject* self, PyObject* item) { if (PyIndex_Check(item)) { @@ -1144,9 +1134,8 @@ static PyMappingMethods Vector_AsMapping = { (binaryfunc)Vector_subscript, (objobjargproc)Vector_ass_subscript }; -#endif /* (PY_VERSION_HEX >= 0x03000000) */ - -#if (PY_VERSION_HEX >= 0x03000000) + + static PyNumberMethods Vector_NumMethods = { (binaryfunc) Vector_add, /*nb_add*/ (binaryfunc) Vector_sub, /*nb_subtract*/ @@ -1183,53 +1172,6 @@ static PyNumberMethods Vector_NumMethods = { Vector_idiv, /* nb_inplace_true_divide */ 0, /* nb_index */ }; -#else -static PyNumberMethods Vector_NumMethods = { - (binaryfunc) Vector_add, /* __add__ */ - (binaryfunc) Vector_sub, /* __sub__ */ - (binaryfunc) Vector_mul, /* __mul__ */ - (binaryfunc) Vector_div, /* __div__ */ - (binaryfunc) NULL, /* __mod__ */ - (binaryfunc) NULL, /* __divmod__ */ - (ternaryfunc) NULL, /* __pow__ */ - (unaryfunc) Vector_neg, /* __neg__ */ - (unaryfunc) NULL, /* __pos__ */ - (unaryfunc) NULL, /* __abs__ */ - (inquiry) NULL, /* __nonzero__ */ - (unaryfunc) NULL, /* __invert__ */ - (binaryfunc) NULL, /* __lshift__ */ - (binaryfunc) NULL, /* __rshift__ */ - (binaryfunc) NULL, /* __and__ */ - (binaryfunc) NULL, /* __xor__ */ - (binaryfunc) NULL, /* __or__ */ - /*(coercion)*/ NULL, /* __coerce__ */ - (unaryfunc) NULL, /* __int__ */ - (unaryfunc) NULL, /* __long__ */ - (unaryfunc) NULL, /* __float__ */ - (unaryfunc) NULL, /* __oct__ */ - (unaryfunc) NULL, /* __hex__ */ - - /* Added in release 2.0 */ - (binaryfunc) Vector_iadd, /*__iadd__*/ - (binaryfunc) Vector_isub, /*__isub__*/ - (binaryfunc) Vector_imul, /*__imul__*/ - (binaryfunc) Vector_idiv, /*__idiv__*/ - (binaryfunc) NULL, /*__imod__*/ - (ternaryfunc) NULL, /*__ipow__*/ - (binaryfunc) NULL, /*__ilshift__*/ - (binaryfunc) NULL, /*__irshift__*/ - (binaryfunc) NULL, /*__iand__*/ - (binaryfunc) NULL, /*__ixor__*/ - (binaryfunc) NULL, /*__ior__*/ - - /* Added in release 2.2 */ - /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ - (binaryfunc) NULL, /*__floordiv__ __rfloordiv__*/ - (binaryfunc) NULL, /*__truediv__ __rfloordiv__*/ - (binaryfunc) NULL, /*__ifloordiv__*/ - (binaryfunc) NULL, /*__itruediv__*/ -}; -#endif /*------------------PY_OBECT DEFINITION--------------------------*/ @@ -1872,13 +1814,7 @@ if len(unique) != len(items): */ PyTypeObject vector_Type = { -#if (PY_VERSION_HEX >= 0x02060000) PyVarObject_HEAD_INIT(NULL, 0) -#else - /* python 2.5 and below */ - PyObject_HEAD_INIT( NULL ) /* required py macro */ - 0, /* ob_size */ -#endif /* For printing, in format "<module>.<name>" */ "vector", /* char *tp_name; */ sizeof( VectorObject ), /* int tp_basicsize; */ @@ -1897,11 +1833,7 @@ PyTypeObject vector_Type = { &Vector_NumMethods, /* PyNumberMethods *tp_as_number; */ &Vector_SeqMethods, /* PySequenceMethods *tp_as_sequence; */ -#if (PY_VERSION_HEX >= 0x03000000) &Vector_AsMapping, /* PyMappingMethods *tp_as_mapping; */ -#else - NULL, -#endif /* More standard operations (here for binary compatibility) */ diff --git a/source/blender/python/generic/vector.h b/source/blender/python/generic/vector.h index f6babac7ed9..a13ec0f80f3 100644 --- a/source/blender/python/generic/vector.h +++ b/source/blender/python/generic/vector.h @@ -31,7 +31,6 @@ #define EXPP_vector_h #include <Python.h> -#include "../intern/bpy_compat.h" extern PyTypeObject vector_Type; #define VectorObject_Check(_v) PyObject_TypeCheck((_v), &vector_Type) |