--- policycoreutils/sepolicy/policy.c | 29 ++++++++++++++++++++++++--- policycoreutils/sepolicy/sepolicy/__init__.py | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/policycoreutils/sepolicy/policy.c b/policycoreutils/sepolicy/policy.c index b7e3536..423a926 100644 --- a/policycoreutils/sepolicy/policy.c +++ b/policycoreutils/sepolicy/policy.c @@ -86,8 +86,31 @@ static PyMethodDef methods[] = { {NULL, NULL, 0, NULL} /* sentinel */ }; +#if PY_MAJOR_VERSION >= 3 + +static struct PyModuleDef module_def = +{ + PyModuleDef_HEAD_INIT, + "_policy", /* name of module */ + "", /* module documentation, may be NULL */ + -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ + (PyMethodDef*)&methods, +}; + +PyMODINIT_FUNC PyInit__policy(void) +{ + PyObject *m; + m = PyModule_Create(&module_def); + init_info(m); + return m; +} + +#else // python 2 + void init_policy(void) { -PyObject *m; -m = Py_InitModule("_policy", methods); -init_info(m); + PyObject *m; + m = Py_InitModule("_policy", methods); + init_info(m); } + +#endif diff --git a/policycoreutils/sepolicy/sepolicy/__init__.py b/policycoreutils/sepolicy/sepolicy/__init__.py index 693c6fe..7804b5c 100644 --- a/policycoreutils/sepolicy/sepolicy/__init__.py +++ b/policycoreutils/sepolicy/sepolicy/__init__.py @@ -3,7 +3,7 @@ # Author: Dan Walsh <dwalsh@xxxxxxxxxx> # Author: Ryan Hallisey <rhallise@xxxxxxxxxx> -import _policy +from . import _policy import selinux import glob PROGNAME = "policycoreutils" -- 2.7.3 _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.