own recent commit broke this python import:

from mathutils.geometry import PolyFill

I couldn't find a way for python's inittab to do this so just inserting mathutils.geometry into sys.modules manually.
This commit is contained in:
Campbell Barton 2010-10-31 13:17:39 +00:00
parent 3a3ac0de8f
commit 6b677a2616
4 changed files with 26 additions and 15 deletions

@ -543,25 +543,28 @@ IF(WIN32)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
ELSE(MSVC) # MINGW
SET(LLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
SET(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
ELSE(MSVC)
# keep GCC spesific stuff here
IF(CMAKE_COMPILER_IS_GNUCC)
SET(LLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
SET(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
# Better warnings
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
# Better warnings
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS(-DFREE_WINDOWS)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)
IF(WITH_INTERNATIONAL)
SET(GETTEXT ${LIBDIR}/gcc/gettext)
SET(GETTEXT_INC ${GETTEXT}/include)

@ -282,7 +282,7 @@ behaviour, though it may not be the best in practice.
#elif defined(__GNUC__)
#define BM_INLINE static inline __attribute((always_inline))
#else
#warning "MSC/GNUC defines not found, inline non-functional"
/* #warning "MSC/GNUC defines not found, inline non-functional" */
#define BM_INLINE static
#endif

@ -248,6 +248,7 @@ static struct PyModuleDef M_Mathutils_module_def = {
PyMODINIT_FUNC BPyInit_mathutils(void)
{
PyObject *submodule;
PyObject *item;
if( PyType_Ready( &vector_Type ) < 0 )
return NULL;
@ -270,8 +271,13 @@ PyMODINIT_FUNC BPyInit_mathutils(void)
PyModule_AddObject( submodule, "Color", (PyObject *)&color_Type );
/* submodule */
PyModule_AddObject( submodule, "geometry", BPyInit_mathutils_geometry());
PyModule_AddObject( submodule, "geometry", (item=BPyInit_mathutils_geometry()));
/* XXX, python doesnt do imports with this usefully yet
* 'from mathutils.geometry import PolyFill'
* ...fails without this. */
PyDict_SetItemString(PyThreadState_GET()->interp->modules, "mathutils.geometry", item);
Py_INCREF(item);
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
return submodule;

@ -199,6 +199,7 @@ void BPY_set_context(bContext *C)
/* init-tab */
extern PyObject *BPyInit_noise(void);
extern PyObject *BPyInit_mathutils(void);
// extern PyObject *BPyInit_mathutils_geometry(void); // BPyInit_mathutils calls, py doesnt work with thos :S
extern PyObject *BPyInit_bgl(void);
extern PyObject *BPyInit_blf(void);
extern PyObject *AUD_initPython(void);
@ -206,6 +207,7 @@ extern PyObject *AUD_initPython(void);
static struct _inittab bpy_internal_modules[]= {
{"noise", BPyInit_noise},
{"mathutils", BPyInit_mathutils},
// {"mathutils.geometry", BPyInit_mathutils_geometry},
{"bgl", BPyInit_bgl},
{"blf", BPyInit_blf},
{"aud", AUD_initPython},