+ simplify porting of DraftUtils module to Python3
This commit is contained in:
@@ -29,25 +29,21 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
|
||||
extern struct PyMethodDef DraftUtils_methods[];
|
||||
|
||||
PyDoc_STRVAR(module_DraftUtils_doc, "The DraftUtils module contains utility functions for the Draft module.");
|
||||
namespace DraftUtils {
|
||||
extern PyObject* initModule();
|
||||
}
|
||||
|
||||
/* Python entry */
|
||||
extern "C" {
|
||||
|
||||
void DraftUtilsExport initDraftUtils()
|
||||
{
|
||||
// load dependent module
|
||||
try {
|
||||
Base::Interpreter().loadModule("Part");
|
||||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
return;
|
||||
}
|
||||
Py_InitModule3("DraftUtils", DraftUtils_methods, module_DraftUtils_doc); /* mod name, table ptr */
|
||||
Base::Console().Log("Loading DraftUtils module... done\n");
|
||||
PyMODINIT_FUNC initDraftUtils()
|
||||
{
|
||||
// load dependent module
|
||||
try {
|
||||
Base::Interpreter().loadModule("Part");
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
return;
|
||||
}
|
||||
(void)DraftUtils::initModule();
|
||||
Base::Console().Log("Loading DraftUtils module... done\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user