python: Compile security module, handle uint.
[idra/samba.git] / source4 / scripting / python / modules.c
1 /* 
2    Unix SMB/CIFS implementation.
3    Samba utility functions
4    Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "includes.h"
21 #include <Python.h>
22 #include "build.h"
23
24 extern void init_ldb(void);
25 extern void init_security(void);
26 extern void init_registry(void);
27 extern void init_param(void);
28 extern void init_misc(void);
29 extern void init_ldb(void);
30 extern void init_auth(void);
31 extern void init_credentials(void);
32 extern void init_tdb(void);
33 extern void init_dcerpc(void);
34 extern void init_events(void);
35 extern void inituuid(void);
36 extern void init_net(void);
37 extern void initecho(void);
38 extern void initwinreg(void);
39 extern void initepmapper(void);
40 extern void initinitshutdown(void);
41 static void initdcerpc_misc(void) {} 
42 extern void initmgmt(void);
43 extern void initatsvc(void);
44 extern void initsamr(void);
45 extern void initsecurity(void);
46 extern void initlsa(void);
47
48 static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES };
49
50 void py_load_samba_modules(void)
51 {
52         int i;
53         for (i = 0; i < ARRAY_SIZE(py_modules); i++) {
54                 PyImport_ExtendInittab(&py_modules[i]);
55         }
56 }
57
58 void py_update_path(const char *bindir)
59 {
60         char *newpath;
61         asprintf(&newpath, "%s:%s/python:%s/../scripting/python", Py_GetPath(), bindir, bindir);
62         PySys_SetPath(newpath);
63         free(newpath);
64 }