mirror of
https://github.com/opencv/opencv.git
synced 2026-07-28 23:03:03 +04:00
python: 'sub-module' for binding sources and documentation meta information
This commit is contained in:
@@ -9,6 +9,12 @@
|
||||
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
||||
#include <numpy/ndarrayobject.h>
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
# define CV_PYTHON_TYPE_HEAD_INIT() PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
#else
|
||||
# define CV_PYTHON_TYPE_HEAD_INIT() PyObject_HEAD_INIT(&PyType_Type) 0,
|
||||
#endif
|
||||
|
||||
#include "pyopencv_generated_include.h"
|
||||
#include "opencv2/core/types_c.h"
|
||||
|
||||
|
||||
@@ -46,20 +46,7 @@ gen_template_func_body = Template("""$code_decl
|
||||
}
|
||||
""")
|
||||
|
||||
py_major_version = sys.version_info[0]
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 3:
|
||||
if sys.argv[3] == 'PYTHON3':
|
||||
py_major_version = 3
|
||||
elif sys.argv[3] == 'PYTHON2':
|
||||
py_major_version = 2
|
||||
else:
|
||||
raise Exception('Incorrect argument: expected PYTHON2 or PYTHON3, received: ' + sys.argv[3])
|
||||
if py_major_version >= 3:
|
||||
head_init_str = "PyVarObject_HEAD_INIT(&PyType_Type, 0)"
|
||||
else:
|
||||
head_init_str = """PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,"""
|
||||
head_init_str = "CV_PYTHON_TYPE_HEAD_INIT()"
|
||||
|
||||
gen_template_simple_type_decl = Template("""
|
||||
struct pyopencv_${name}_t
|
||||
|
||||
Reference in New Issue
Block a user