mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
build: allow the waf build to work with python 3.0 and 3.1
Python 3.x is a bit fussier about print statements and indentation. Signed-off-by: Andrew Tridgell <tridge@samba.org>
This commit is contained in:
parent
64957ce068
commit
7f3116a63d
@ -545,7 +545,7 @@ def SAMBA_CONFIG_H(conf, path=None):
|
||||
testflags=True)
|
||||
|
||||
if Options.options.pedantic:
|
||||
conf.ADD_CFLAGS('-W', testflags=True)
|
||||
conf.ADD_CFLAGS('-W', testflags=True)
|
||||
|
||||
if path is None:
|
||||
conf.write_config_header('config.h', top=True)
|
||||
|
@ -96,10 +96,9 @@ def build_dependencies(self):
|
||||
|
||||
if getattr(self, 'uselib', None):
|
||||
up_list = []
|
||||
for l in self.uselib:
|
||||
up_list.append(l.upper())
|
||||
self.uselib = up_list
|
||||
|
||||
for l in self.uselib:
|
||||
up_list.append(l.upper())
|
||||
self.uselib = up_list
|
||||
|
||||
def build_includes(self):
|
||||
'''This builds the right set of includes for a target.
|
||||
@ -280,7 +279,7 @@ def check_orpaned_targets(bld, tgt_list):
|
||||
type = target_dict[t.sname]
|
||||
if not type in ['BINARY', 'LIBRARY', 'MODULE', 'ET', 'PYTHON']:
|
||||
if re.search('^PIDL_', t.sname) is None:
|
||||
print "Target %s of type %s is unused by any other target" % (t.sname, type)
|
||||
print("Target %s of type %s is unused by any other target" % (t.sname, type))
|
||||
|
||||
|
||||
def show_final_deps(bld, tgt_list):
|
||||
@ -329,7 +328,7 @@ def build_direct_deps(bld, tgt_list):
|
||||
d = EXPAND_ALIAS(bld, d)
|
||||
if d == t.sname: continue
|
||||
if not d in targets:
|
||||
print "Unknown dependency %s in %s" % (d, t.sname)
|
||||
print("Unknown dependency %s in %s" % (d, t.sname))
|
||||
raise
|
||||
if targets[d] in [ 'EMPTY', 'DISABLED' ]:
|
||||
continue
|
||||
@ -344,7 +343,7 @@ def build_direct_deps(bld, tgt_list):
|
||||
continue
|
||||
t2 = bld.name_to_obj(d, bld.env)
|
||||
if t2 is None:
|
||||
print "no task %s type %s" % (d, targets[d])
|
||||
print("no task %s type %s" % (d, targets[d]))
|
||||
if t2.samba_type in [ 'LIBRARY', 'MODULE' ]:
|
||||
t.direct_libs.add(d)
|
||||
elif t2.samba_type in [ 'SUBSYSTEM', 'ASN1', 'PYTHON' ]:
|
||||
@ -823,7 +822,7 @@ def check_project_rules(bld):
|
||||
continue
|
||||
t = bld.name_to_obj(tgt, bld.env)
|
||||
if t is None:
|
||||
print "Target %s of type %s has no task generator" % (tgt, type)
|
||||
print("Target %s of type %s has no task generator" % (tgt, type))
|
||||
raise
|
||||
tgt_list.append(t)
|
||||
|
||||
@ -832,7 +831,7 @@ def check_project_rules(bld):
|
||||
if load_samba_deps(bld, tgt_list):
|
||||
return
|
||||
|
||||
print "Checking project rules ..."
|
||||
print("Checking project rules ...")
|
||||
|
||||
debug('deps: project rules checking started')
|
||||
|
||||
@ -851,7 +850,7 @@ def check_project_rules(bld):
|
||||
#check_orpaned_targets(bld, tgt_list)
|
||||
|
||||
if not check_duplicate_sources(bld, tgt_list):
|
||||
print "Duplicate sources present - aborting"
|
||||
print("Duplicate sources present - aborting")
|
||||
sys.exit(1)
|
||||
|
||||
show_final_deps(bld, tgt_list)
|
||||
@ -861,7 +860,7 @@ def check_project_rules(bld):
|
||||
|
||||
save_samba_deps(bld, tgt_list)
|
||||
|
||||
print "Project rules pass"
|
||||
print("Project rules pass")
|
||||
|
||||
|
||||
def CHECK_PROJECT_RULES(bld):
|
||||
|
@ -7,6 +7,8 @@ import Options
|
||||
from TaskGen import feature, before, after
|
||||
from samba_utils import *
|
||||
|
||||
O755 = 493
|
||||
|
||||
@feature('install_bin')
|
||||
@after('apply_core')
|
||||
@before('apply_link')
|
||||
@ -41,7 +43,7 @@ def install_binary(self):
|
||||
# tell waf to install the right binary
|
||||
bld.install_as(os.path.join(install_path, orig_target),
|
||||
os.path.join(self.path.abspath(bld.env), self.target),
|
||||
chmod=0755)
|
||||
chmod=O755)
|
||||
|
||||
|
||||
|
||||
|
@ -220,7 +220,7 @@ def subst_vars_error(string, env):
|
||||
if re.match('\$\{\w+\}', v):
|
||||
vname = v[2:-1]
|
||||
if not vname in env:
|
||||
print "Failed to find variable %s in %s" % (vname, string)
|
||||
print("Failed to find variable %s in %s" % (vname, string))
|
||||
sys.exit(1)
|
||||
v = env[vname]
|
||||
out.append(v)
|
||||
@ -356,7 +356,7 @@ def RUN_COMMAND(cmd,
|
||||
return os.WEXITSTATUS(status)
|
||||
if os.WIFSIGNALED(status):
|
||||
return - os.WTERMSIG(status)
|
||||
print "Unknown exit reason %d for command: %s" (status, cmd)
|
||||
print("Unknown exit reason %d for command: %s" (status, cmd))
|
||||
return -1
|
||||
|
||||
|
||||
@ -434,7 +434,7 @@ def RECURSE(ctx, directory):
|
||||
return ctx.sub_config(relpath)
|
||||
if ctxclass == 'BuildContext':
|
||||
return ctx.add_subdirs(relpath)
|
||||
print 'Unknown RECURSE context class', ctxclass
|
||||
print('Unknown RECURSE context class', ctxclass)
|
||||
raise
|
||||
Options.Handler.RECURSE = RECURSE
|
||||
Build.BuildContext.RECURSE = RECURSE
|
||||
|
@ -25,6 +25,8 @@ import irixcc
|
||||
import generic_cc
|
||||
import samba_dist
|
||||
|
||||
O644 = 420
|
||||
|
||||
# some systems have broken threading in python
|
||||
if os.environ.get('WAF_NOTHREADS') == '1':
|
||||
import nothreads
|
||||
@ -523,7 +525,7 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
|
||||
Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
|
||||
|
||||
|
||||
def install_file(bld, destdir, file, chmod=0644, flat=False,
|
||||
def install_file(bld, destdir, file, chmod=O644, flat=False,
|
||||
python_fixup=False, destname=None, base_name=None):
|
||||
'''install a file'''
|
||||
destdir = bld.EXPAND_VARIABLES(destdir)
|
||||
@ -545,7 +547,7 @@ def install_file(bld, destdir, file, chmod=0644, flat=False,
|
||||
bld.install_as(dest, file, chmod=chmod)
|
||||
|
||||
|
||||
def INSTALL_FILES(bld, destdir, files, chmod=0644, flat=False,
|
||||
def INSTALL_FILES(bld, destdir, files, chmod=O644, flat=False,
|
||||
python_fixup=False, destname=None, base_name=None):
|
||||
'''install a set of files'''
|
||||
for f in TO_LIST(files):
|
||||
@ -555,7 +557,7 @@ def INSTALL_FILES(bld, destdir, files, chmod=0644, flat=False,
|
||||
Build.BuildContext.INSTALL_FILES = INSTALL_FILES
|
||||
|
||||
|
||||
def INSTALL_WILDCARD(bld, destdir, pattern, chmod=0644, flat=False,
|
||||
def INSTALL_WILDCARD(bld, destdir, pattern, chmod=O644, flat=False,
|
||||
python_fixup=False, exclude=None, trim_path=None):
|
||||
'''install a set of files matching a wildcard pattern'''
|
||||
files=TO_LIST(bld.path.ant_glob(pattern))
|
||||
@ -623,7 +625,7 @@ def subst_at_vars(task):
|
||||
if not vname in task.env and vname.upper() in task.env:
|
||||
vname = vname.upper()
|
||||
if not vname in task.env:
|
||||
print "Unknown substitution %s in %s" % (v, task.name)
|
||||
print("Unknown substitution %s in %s" % (v, task.name))
|
||||
raise
|
||||
v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
|
||||
# now we back substitute the allowed pc vars
|
||||
|
@ -8,9 +8,7 @@ def set_options(opt):
|
||||
action="store_true", dest='enable_socket_wrapper', default=False)
|
||||
|
||||
def configure(conf):
|
||||
if (Options.options.enable_socket_wrapper or
|
||||
Options.options.developer or
|
||||
Options.options.enable_selftest):
|
||||
if (Options.options.enable_socket_wrapper or Options.options.developer or Options.options.enable_selftest):
|
||||
conf.DEFINE('SOCKET_WRAPPER', 1)
|
||||
conf.ADD_GLOBAL_DEPENDENCY('SOCKET_WRAPPER')
|
||||
conf.ADD_GLOBAL_DEPENDENCY('SOCKET_WRAPPER')
|
||||
|
||||
|
@ -68,7 +68,7 @@ for (define, msg, code, headers) in statfs_types:
|
||||
break
|
||||
|
||||
if not found_statfs:
|
||||
print "FATAL: Failed to find a statfs method"
|
||||
print("FATAL: Failed to find a statfs method")
|
||||
raise
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ external_libs = {
|
||||
|
||||
list = []
|
||||
|
||||
for module, package in external_libs.iteritems():
|
||||
for module, package in external_libs.items():
|
||||
try:
|
||||
__import__(module)
|
||||
except ImportError:
|
||||
|
@ -16,9 +16,9 @@ def configure(conf):
|
||||
# yapp is used for building the parser
|
||||
conf.find_program('yapp', var='YAPP')
|
||||
|
||||
|
||||
O755 = 493
|
||||
def build(bld):
|
||||
bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=0755)
|
||||
bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=O755)
|
||||
|
||||
bld.RECURSE('lib')
|
||||
|
||||
|
@ -62,7 +62,7 @@ def get_varname(v):
|
||||
if v.startswith('with-'):
|
||||
v = v[5:]
|
||||
v = v.upper()
|
||||
v = string.replace(v, '-', '_')
|
||||
v = v.replace('-', '_')
|
||||
return v
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ def configure(conf):
|
||||
|
||||
if (not Options.options.ENABLE_FHS and
|
||||
(conf.env.PREFIX == '/usr' or conf.env.PREFIX == '/usr/local')):
|
||||
print "ERROR: Don't install directly under /usr or /usr/local without using the FHS option (--enable-fhs)"
|
||||
print("ERROR: Don't install directly under /usr or /usr/local without using the FHS option (--enable-fhs)")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
O755 = 493
|
||||
bld.INSTALL_FILES('${SBINDIR}','bin/upgradeprovision bin/samba_dnsupdate',
|
||||
chmod=0755, python_fixup=True, flat=True)
|
||||
chmod=O755, python_fixup=True, flat=True)
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ def cmd_testonly(opt):
|
||||
if (not CONFIG_SET(opt, 'NSS_WRAPPER') or
|
||||
not CONFIG_SET(opt, 'UID_WRAPPER') or
|
||||
not CONFIG_SET(opt, 'SOCKET_WRAPPER')):
|
||||
print "ERROR: You must use --enable-selftest to enable selftest"
|
||||
print("ERROR: You must use --enable-selftest to enable selftest")
|
||||
sys.exit(1)
|
||||
|
||||
env.TESTS = Options.options.TESTS
|
||||
@ -73,12 +73,12 @@ def cmd_testonly(opt):
|
||||
env.FILTER_OPTIONS = '${FILTER_XFAIL} | ${FORMAT_TEST_OUTPUT}'
|
||||
|
||||
if Options.options.VALGRIND:
|
||||
os.environ['VALGRIND'] = 'valgrind -q --num-callers=30'
|
||||
os.environ['VALGRIND'] = 'valgrind -q --num-callers=30'
|
||||
if Options.options.VALGRINDLOG is not None:
|
||||
os.environ['VALGRIND'] += ' --log-file=%s' % Options.options.VALGRINDLOG
|
||||
|
||||
if Options.options.VALGRIND_SERVER:
|
||||
os.environ['SAMBA_VALGRIND'] = 'xterm -n server -e ../selftest/valgrind_run A=B '
|
||||
os.environ['SAMBA_VALGRIND'] = 'xterm -n server -e ../selftest/valgrind_run A=B '
|
||||
|
||||
env.SELFTEST_PREFIX = Options.options.SELFTEST_PREFIX
|
||||
|
||||
@ -95,7 +95,7 @@ def cmd_testonly(opt):
|
||||
cmd = '(${PERL} ../selftest/selftest.pl --prefix=${SELFTEST_PREFIX} --builddir=. --srcdir=. --exclude=./selftest/skip --testlist="./selftest/tests.sh|" ${OPTIONS} --socket-wrapper ${TESTS} && touch ${SELFTEST_PREFIX}/st_done) | ${FILTER_OPTIONS}'
|
||||
cmd = EXPAND_VARIABLES(opt, cmd)
|
||||
|
||||
print "test: running %s" % cmd
|
||||
print("test: running %s" % cmd)
|
||||
ret = RUN_COMMAND(cmd, env=env)
|
||||
if ret != 0:
|
||||
print("ERROR: test failed with exit code %d" % ret)
|
||||
|
@ -3,7 +3,8 @@
|
||||
bld.INSTALL_WILDCARD('${SETUPDIR}', 'ad-schema/*.txt')
|
||||
bld.INSTALL_WILDCARD('${SETUPDIR}', 'display-specifiers/*.txt')
|
||||
|
||||
bld.INSTALL_FILES('${SBINDIR}','provision', chmod=0755, python_fixup=True)
|
||||
O755 = 493
|
||||
bld.INSTALL_FILES('${SBINDIR}','provision', chmod=O755, python_fixup=True)
|
||||
|
||||
bld.INSTALL_FILES('${PRIVATEDIR}', 'dns_update_list')
|
||||
|
||||
|
@ -89,7 +89,7 @@ def etags(ctx):
|
||||
import Utils
|
||||
source_root = os.path.dirname(Utils.g_module.root_path)
|
||||
cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
|
||||
print "Running: %s" % cmd
|
||||
print("Running: %s" % cmd)
|
||||
os.system(cmd)
|
||||
|
||||
def ctags(ctx):
|
||||
@ -97,7 +97,7 @@ def ctags(ctx):
|
||||
import Utils
|
||||
source_root = os.path.dirname(Utils.g_module.root_path)
|
||||
cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
|
||||
print "Running: %s" % cmd
|
||||
print("Running: %s" % cmd)
|
||||
os.system(cmd)
|
||||
|
||||
# putting this here enabled build in the list
|
||||
@ -110,7 +110,7 @@ def build(bld):
|
||||
def pydoctor(ctx):
|
||||
'''build python apidocs'''
|
||||
cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package bin/python/samba'
|
||||
print "Running: %s" % cmd
|
||||
print("Running: %s" % cmd)
|
||||
os.system(cmd)
|
||||
|
||||
def wafdocs(ctx):
|
||||
@ -120,10 +120,10 @@ def wafdocs(ctx):
|
||||
list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
|
||||
|
||||
cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
|
||||
print list
|
||||
print(list)
|
||||
for f in list:
|
||||
cmd += ' --add-module %s' % f
|
||||
print "Running: %s" % cmd
|
||||
print("Running: %s" % cmd)
|
||||
os.system(cmd)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user