python module mac compilation
This commit is contained in:
parent
5f61c2edff
commit
90bd9d466d
@ -291,5 +291,17 @@ initrclextract(void)
|
||||
Py_INCREF(&rclx_ExtractorType);
|
||||
PyModule_AddObject(m, "Extractor", (PyObject *)&rclx_ExtractorType);
|
||||
|
||||
#if PY_MAJOR_VERSION >= 2 && PY_MINOR_VERSION >= 7
|
||||
recoll_DocType = (PyObject*)PyCapsule_Import(PYRECOLL_PACKAGE "recoll.doctypeptr", 0);
|
||||
#else
|
||||
PyObject *module = PyImport_ImportModule(PYRECOLL_PACKAGE "recoll");
|
||||
if (module != NULL) {
|
||||
PyObject *cobject = PyObject_GetAttrString(module, "_C_API");
|
||||
if (cobject == NULL)
|
||||
return;
|
||||
if (PyCObject_Check(cobject))
|
||||
recoll_DocType = (PyObject*)PyCObject_AsVoidPtr(cobject);
|
||||
Py_DECREF(cobject);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1857,8 +1857,14 @@ initrecoll(void)
|
||||
PyModule_AddStringConstant(m, "__doc__",
|
||||
pyrecoll_doc_string);
|
||||
|
||||
PyObject *doctypecobject;
|
||||
|
||||
#if PY_MAJOR_VERSION >= 2 && PY_MINOR_VERSION >= 7
|
||||
// Export a few pointers for the benefit of other recoll python modules
|
||||
PyObject* doctypecapsule =
|
||||
doctypecobject=
|
||||
PyCapsule_New(&recoll_DocType, PYRECOLL_PACKAGE "recoll.doctypeptr", 0);
|
||||
PyModule_AddObject(m, "doctypeptr", doctypecapsule);
|
||||
#else
|
||||
doctypecobject = PyCObject_FromVoidPtr(&recoll_DocType, NULL);
|
||||
#endif
|
||||
PyModule_AddObject(m, "doctypeptr", doctypecobject);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user