Support Python 2.7.

This commit is contained in:
Jonathan L Long
2016-12-05 15:22:32 -08:00
parent aa4dabe64f
commit c207ff3561
2 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,2 @@
* PBR material * PBR material
* Define index_t struct * Define index_t struct
* Python 2.7 binding

View File

@@ -1,4 +1,4 @@
// python3 module for tinyobjloader // python2/3 module for tinyobjloader
// //
// usage: // usage:
// import tinyobjloader as tol // import tinyobjloader as tol
@@ -182,10 +182,21 @@ static PyMethodDef mMethods[] = {
}; };
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {PyModuleDef_HEAD_INIT, "tinyobjloader", static struct PyModuleDef moduledef = {PyModuleDef_HEAD_INIT, "tinyobjloader",
NULL, -1, mMethods}; NULL, -1, mMethods};
PyMODINIT_FUNC PyInit_tinyobjloader(void) { PyMODINIT_FUNC PyInit_tinyobjloader(void) {
return PyModule_Create(&moduledef); return PyModule_Create(&moduledef);
} }
#else
PyMODINIT_FUNC inittinyobjloader(void) {
Py_InitModule3("tinyobjloader", mMethods, NULL);
}
#endif // PY_MAJOR_VERSION >= 3
} }