s4-python: added PYTHONDIR to python search path
authorAndrew Tridgell <tridge@samba.org>
Tue, 20 Apr 2010 10:24:08 +0000 (20:24 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 20 Apr 2010 10:59:24 +0000 (20:59 +1000)
we put it after the scripting/python dir, so we look in the build
directory (if applicable) first.

source4/scripting/python/modules.c

index 198b3ccf12e8c941655c145792b83a5d28558f71..788df91bb4c0c25ab96cc119332a3bd58b80271e 100644 (file)
@@ -20,6 +20,7 @@
 #include <Python.h>
 #include "includes.h"
 #include "scripting/python/modules.h"
+#include "dynconfig/dynconfig.h"
 
 extern void init_ldb(void);
 extern void init_security(void);
@@ -89,6 +90,10 @@ bool py_update_path(const char *bindir)
                return false;
        }
 
+       if (!PySys_PathPrepend(py_path, dyn_PYTHONDIR)) {
+               return false;
+       }
+
        asprintf(&newpath, "%s/../scripting/python", bindir);
        if (!PySys_PathPrepend(py_path, newpath)) {
                free(newpath);