diff options
author | bubulle <bubulle@alioth.debian.org> | 2011-06-07 20:43:08 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2011-06-07 20:43:08 +0000 |
commit | e64520a9ed05c9782a6e8ca8015fdef01b92ecc3 (patch) | |
tree | fc3a71a0b741cbcc6a5a892f91cc0f2218dfe656 /source4/scripting/python/modules.c | |
parent | 6fe9013ae23927a67fa6b6033e2711cef99b3533 (diff) | |
download | samba-e64520a9ed05c9782a6e8ca8015fdef01b92ecc3.tar.gz |
Revert upstream branch to 3.5.8....oops
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@3810 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source4/scripting/python/modules.c')
-rw-r--r-- | source4/scripting/python/modules.c | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c index 78cdbc0d87..e53f4cfaf2 100644 --- a/source4/scripting/python/modules.c +++ b/source4/scripting/python/modules.c @@ -17,47 +17,54 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <Python.h> #include "includes.h" #include "scripting/python/modules.h" -#include "dynconfig/dynconfig.h" +#include <Python.h> -static bool PySys_PathPrepend(PyObject *list, const char *path) -{ - PyObject *py_path = PyString_FromString(path); - if (py_path == NULL) - return false; +extern void init_ldb(void); +extern void init_security(void); +extern void init_registry(void); +extern void init_param(void); +extern void init_misc(void); +extern void init_ldb(void); +extern void init_auth(void); +extern void init_credentials(void); +extern void init_tdb(void); +extern void init_dcerpc(void); +extern void init_events(void); +extern void inituuid(void); +extern void init_net(void); +extern void initecho(void); +extern void initdfs(void); +extern void initdrsuapi(void); +extern void initwinreg(void); +extern void initepmapper(void); +extern void initinitshutdown(void); +extern void initmgmt(void); +extern void initnet(void); +extern void initatsvc(void); +extern void initsamr(void); +extern void initlsa(void); +extern void initsvcctl(void); +extern void initwkssvc(void); +extern void initunixinfo(void); +extern void init_libcli_nbt(void); +extern void init_libcli_smb(void); - return (PyList_Insert(list, 0, py_path) == 0); -} +static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES }; -bool py_update_path(void) +void py_load_samba_modules(void) { - PyObject *mod_sys, *py_path; - - mod_sys = PyImport_ImportModule("sys"); - if (mod_sys == NULL) { - return false; - } - - py_path = PyObject_GetAttrString(mod_sys, "path"); - if (py_path == NULL) { - return false; - } - - if (!PyList_Check(py_path)) { - return false; - } - - if (!PySys_PathPrepend(py_path, dyn_PYTHONDIR)) { - return false; - } - - if (strcmp(dyn_PYTHONARCHDIR, dyn_PYTHONDIR) != 0) { - if (!PySys_PathPrepend(py_path, dyn_PYTHONARCHDIR)) { - return false; - } + int i; + for (i = 0; i < ARRAY_SIZE(py_modules); i++) { + PyImport_ExtendInittab(&py_modules[i]); } +} - return true; +void py_update_path(const char *bindir) +{ + char *newpath; + asprintf(&newpath, "%s/python:%s/../scripting/python:%s", bindir, bindir, Py_GetPath()); + PySys_SetPath(newpath); + free(newpath); } |