summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rwxr-xr-xsource4/scripting/bin/minschema.py4
-rwxr-xr-xsource4/scripting/bin/rpcclient4
-rwxr-xr-xsource4/scripting/bin/samba3dump5
-rwxr-xr-xsource4/scripting/bin/subunitrun6
-rwxr-xr-xsource4/scripting/bin/winreg.py4
-rw-r--r--source4/scripting/ejs/config.mk31
-rw-r--r--source4/scripting/ejs/ejsnet/config.mk4
-rw-r--r--source4/scripting/python/config.m41
-rw-r--r--source4/scripting/python/config.mk19
-rw-r--r--source4/scripting/python/smbpython.c34
10 files changed, 47 insertions, 65 deletions
diff --git a/source4/scripting/bin/minschema.py b/source4/scripting/bin/minschema.py
index fb9d7b05aa..6dd5b42aff 100755
--- a/source4/scripting/bin/minschema.py
+++ b/source4/scripting/bin/minschema.py
@@ -4,6 +4,10 @@
#
import optparse
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
import samba
from samba import getopt as options
import sys
diff --git a/source4/scripting/bin/rpcclient b/source4/scripting/bin/rpcclient
index 34efafdf73..aba4f9ddb3 100755
--- a/source4/scripting/bin/rpcclient
+++ b/source4/scripting/bin/rpcclient
@@ -1,6 +1,10 @@
#!/usr/bin/python
import sys, os, string
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
from cmd import Cmd
from optparse import OptionParser
from pprint import pprint
diff --git a/source4/scripting/bin/samba3dump b/source4/scripting/bin/samba3dump
index 8f56d423d8..d89667233f 100755
--- a/source4/scripting/bin/samba3dump
+++ b/source4/scripting/bin/samba3dump
@@ -7,7 +7,10 @@
import optparse
import os, sys
-sys.path.append(os.path.join(os.path.dirname(__file__), "../python"))
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
import samba
import samba.samba3
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index fbbffde42c..de11aba3cc 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -17,8 +17,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from subunit import SubunitTestRunner
import sys
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
+from subunit import SubunitTestRunner
from unittest import TestProgram
import optparse
import os
diff --git a/source4/scripting/bin/winreg.py b/source4/scripting/bin/winreg.py
index 1e39ee8f78..19d39e56ab 100755
--- a/source4/scripting/bin/winreg.py
+++ b/source4/scripting/bin/winreg.py
@@ -7,6 +7,10 @@
#
import sys
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
import winreg
import optparse
import samba.getopt as options
diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk
index 896b292e23..c1a1ca1f0f 100644
--- a/source4/scripting/ejs/config.mk
+++ b/source4/scripting/ejs/config.mk
@@ -1,13 +1,13 @@
[SUBSYSTEM::EJSRPC]
-EJSRPC_OBJ_FILES = scripting/ejs/ejsrpc.o
+EJSRPC_OBJ_FILES = $(ejsscriptsrcdir)/ejsrpc.o
[MODULE::smbcalls_config]
OUTPUT_TYPE = MERGED_OBJ
SUBSYSTEM = smbcalls
INIT_FUNCTION = smb_setup_ejs_config
-smbcalls_config_OBJ_FILES = scripting/ejs/smbcalls_config.o
+smbcalls_config_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_config.o
[MODULE::smbcalls_ldb]
OUTPUT_TYPE = MERGED_OBJ
@@ -15,7 +15,7 @@ SUBSYSTEM = smbcalls
INIT_FUNCTION = smb_setup_ejs_ldb
PRIVATE_DEPENDENCIES = LIBLDB SAMDB LIBNDR
-smbcalls_ldb_OBJ_FILES = scripting/ejs/smbcalls_ldb.o
+smbcalls_ldb_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_ldb.o
[MODULE::smbcalls_reg]
SUBSYSTEM = smbcalls
@@ -23,21 +23,21 @@ OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_reg
PRIVATE_DEPENDENCIES = registry SAMDB LIBNDR
-smbcalls_reg_OBJ_FILES = scripting/ejs/smbcalls_reg.o
+smbcalls_reg_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_reg.o
[MODULE::smbcalls_nbt]
SUBSYSTEM = smbcalls
OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_nbt
-smbcalls_nbt_OBJ_FILES = scripting/ejs/smbcalls_nbt.o
+smbcalls_nbt_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_nbt.o
[MODULE::smbcalls_rand]
SUBSYSTEM = smbcalls
OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_random
-smbcalls_rand_OBJ_FILES = scripting/ejs/smbcalls_rand.o
+smbcalls_rand_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_rand.o
[MODULE::smbcalls_nss]
SUBSYSTEM = smbcalls
@@ -45,14 +45,14 @@ OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_nss
PRIVATE_DEPENDENCIES = NSS_WRAPPER
-smbcalls_nss_OBJ_FILES = scripting/ejs/smbcalls_nss.o
+smbcalls_nss_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_nss.o
[MODULE::smbcalls_data]
SUBSYSTEM = smbcalls
OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_datablob
-smbcalls_data_OBJ_FILES = scripting/ejs/smbcalls_data.o
+smbcalls_data_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_data.o
[MODULE::smbcalls_auth]
OUTPUT_TYPE = MERGED_OBJ
@@ -60,28 +60,27 @@ SUBSYSTEM = smbcalls
INIT_FUNCTION = smb_setup_ejs_auth
PRIVATE_DEPENDENCIES = service_auth
-smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o
+smbcalls_auth_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_auth.o
-smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o
+smbcalls_auth_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_auth.o
[MODULE::smbcalls_string]
SUBSYSTEM = smbcalls
OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_string
-smbcalls_string_OBJ_FILES = scripting/ejs/smbcalls_string.o
+smbcalls_string_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_string.o
[MODULE::smbcalls_sys]
SUBSYSTEM = smbcalls
OUTPUT_TYPE = MERGED_OBJ
INIT_FUNCTION = smb_setup_ejs_system
-smbcalls_sys_OBJ_FILES = scripting/ejs/smbcalls_sys.o
+smbcalls_sys_OBJ_FILES = $(ejsscriptsrcdir)/smbcalls_sys.o
mkinclude ejsnet/config.mk
[SUBSYSTEM::smbcalls]
-PRIVATE_PROTO_HEADER = proto.h
PRIVATE_DEPENDENCIES = \
EJS LIBSAMBA-UTIL \
EJSRPC MESSAGING \
@@ -90,7 +89,7 @@ PRIVATE_DEPENDENCIES = \
dcerpc \
NDR_TABLE
-smbcalls_OBJ_FILES = $(addprefix scripting/ejs/, \
+smbcalls_OBJ_FILES = $(addprefix $(ejsscriptsrcdir)/, \
smbcalls.o \
smbcalls_cli.o \
smbcalls_rpc.o \
@@ -100,6 +99,8 @@ smbcalls_OBJ_FILES = $(addprefix scripting/ejs/, \
mprutil.o \
literal.o)
+$(eval $(call proto_header_template,$(ejsscriptsrcdir)/proto.h,$(smbcalls_OBJ_FILES:.o=.c)))
+
#######################
# Start BINARY SMBSCRIPT
[BINARY::smbscript]
@@ -107,4 +108,4 @@ PRIVATE_DEPENDENCIES = EJS LIBSAMBA-UTIL smbcalls LIBSAMBA-HOSTCONFIG
# End BINARY SMBSCRIPT
#######################
-smbscript_OBJ_FILES = scripting/ejs/smbscript.o
+smbscript_OBJ_FILES = $(ejsscriptsrcdir)/smbscript.o
diff --git a/source4/scripting/ejs/ejsnet/config.mk b/source4/scripting/ejs/ejsnet/config.mk
index 85a5b2bf09..710221e37d 100644
--- a/source4/scripting/ejs/ejsnet/config.mk
+++ b/source4/scripting/ejs/ejsnet/config.mk
@@ -1,13 +1,13 @@
[MODULE::smbcalls_net]
SUBSYSTEM = smbcalls
INIT_FUNCTION = smb_setup_ejs_net
-PRIVATE_PROTO_HEADER = proto.h
PRIVATE_DEPENDENCIES = LIBSAMBA-NET LIBCLI_SMB CREDENTIALS
-smbcalls_net_OBJ_FILES = $(addprefix scripting/ejs/ejsnet/, \
+smbcalls_net_OBJ_FILES = $(addprefix $(ejsscriptsrcdir)/ejsnet/, \
net_ctx.o \
net_user.o \
mpr_user.o \
net_host.o \
mpr_host.o)
+$(eval $(call proto_header_template,$(ejsscriptsrcdir)/ejsnet/proto.h,$(smbcalls_net_OBJ_FILES:.o=.c)))
diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4
index a61d541049..1a86951bfb 100644
--- a/source4/scripting/python/config.m4
+++ b/source4/scripting/python/config.m4
@@ -64,7 +64,6 @@ SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])
AC_MSG_CHECKING(working python module support)
if test $working_python = yes; then
SMB_ENABLE(EXT_LIB_PYTHON,YES)
- SMB_ENABLE(smbpython,YES)
SMB_ENABLE(LIBPYTHON,YES)
AC_MSG_RESULT([yes])
else
diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk
index e57ff1d1ac..1fa273e99d 100644
--- a/source4/scripting/python/config.mk
+++ b/source4/scripting/python/config.mk
@@ -1,31 +1,28 @@
-[BINARY::smbpython]
-PRIVATE_DEPENDENCIES = LIBPYTHON
-
-smbpython_OBJ_FILES = scripting/python/smbpython.o
-
[SUBSYSTEM::LIBPYTHON]
PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON
PRIVATE_DEPENDENCIES = PYTALLOC
INIT_FUNCTION_SENTINEL = { NULL, NULL }
-LIBPYTHON_OBJ_FILES = $(addprefix scripting/python/, modules.o)
+LIBPYTHON_OBJ_FILES = $(addprefix $(pyscriptsrcdir)/, modules.o)
[SUBSYSTEM::PYTALLOC]
PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON
-PYTALLOC_OBJ_FILES = $(addprefix scripting/python/, pytalloc.o)
+PYTALLOC_OBJ_FILES = $(addprefix $(pyscriptsrcdir)/, pytalloc.o)
[PYTHON::python_uuid]
PRIVATE_DEPENDENCIES = LIBNDR
-python_uuid_OBJ_FILES = scripting/python/uuidmodule.o
+python_uuid_OBJ_FILES = $(pyscriptsrcdir)/uuidmodule.o
[PYTHON::python_misc]
PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS
SWIG_FILE = misc.i
-python_misc_OBJ_FILES = scripting/python/misc_wrap.o
+python_misc_OBJ_FILES = $(pyscriptsrcdir)/misc_wrap.o
+
+_PY_FILES = $(shell find $(pyscriptsrcdir) -name "*.py")
-_PY_FILES = $(shell find scripting/python -name "*.py")
+$(foreach pyfile, $(_PY_FILES),$(eval $(call python_py_module_template,$(patsubst $(pyscriptsrcdir)/%,%,$(pyfile)),$(pyfile))))
-$(foreach pyfile, $(_PY_FILES),$(eval $(call python_py_module_template,$(patsubst scripting/python/%,%,$(pyfile)),$(pyfile))))
+install:: installpython
diff --git a/source4/scripting/python/smbpython.c b/source4/scripting/python/smbpython.c
deleted file mode 100644
index c5de53fd60..0000000000
--- a/source4/scripting/python/smbpython.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba utility functions
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include <Python.h>
-#include "scripting/python/modules.h"
-
-int main(int argc, char **argv)
-{
- py_load_samba_modules();
- Py_Initialize();
- if (strchr(argv[0], '/') != NULL) {
- char *bindir = strndup(argv[0], strrchr(argv[0], '/')-argv[0]);
- py_update_path(bindir);
- free(bindir);
- }
- return Py_Main(argc,argv);
-}