DEBUG(0,("Provision for Become-DC test using python\n"));
Py_Initialize();
- py_update_path("bin"); /* FIXME: Can't assume this is always the case */
+ py_update_path(); /* Put the samba path at the start of sys.path */
provision_mod = provision_module();
}
Py_Initialize();
- py_update_path("bin"); /* FIXME: Can't assume this is always the case */
+ py_update_path(); /* Put the samba path at the start of sys.path */
provision_mod = provision_module();
if (provision_mod == NULL) {
PyObject *schema_mod, *schema_dict, *schema_fn, *py_result, *parameters;
Py_Initialize();
- py_update_path("bin"); /* FIXME: Can't assume this is always the case */
+ py_update_path(); /* Put the samba path at the start of sys.path */
schema_mod = schema_module();
}
Py_Initialize();
PySys_SetArgv(argc, discard_const_p(char *, argv));
- py_update_path("bin"); /* FIXME: Can't assume this is always the case */
+ py_update_path(); /* Put the Samba path at the start of sys.path */
py_cmds = py_commands();
if (py_cmds == NULL) {
return (PyList_Insert(list, 0, py_path) == 0);
}
-bool py_update_path(const char *bindir)
+bool py_update_path()
{
char *newpath;
PyObject *mod_sys, *py_path;
return false;
}
- if (asprintf(&newpath, "%s/../scripting/python", bindir) < 0) {
- return false;
- }
- if (!PySys_PathPrepend(py_path, newpath)) {
- free(newpath);
- return false;
- }
- free(newpath);
-
- if (asprintf(&newpath, "%s/python", bindir) < 0) {
- return false;
- }
- if (!PySys_PathPrepend(py_path, newpath)) {
- free(newpath);
- return false;
- }
- free(newpath);
-
return true;
}
#ifndef __SAMBA_PYTHON_MODULES_H__
#define __SAMBA_PYTHON_MODULES_H__
-bool py_update_path(const char *bindir);
+bool py_update_path();
#endif /* __SAMBA_PYTHON_MODULES_H__ */
Py_Initialize();
- py_update_path("bin"); /* FIXME: Can't assume this is always the case */
+ py_update_path(); /* Ensure that we have the Samba paths at
+ * the start of the sys.path() */
if (PyType_Ready(&web_request_Type) < 0)
return false;