Python 3.x is a bit fussier about print statements and indentation.
Signed-off-by: Andrew Tridgell <tridge@samba.org>
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)
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.
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):
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
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' ]:
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)
if load_samba_deps(bld, tgt_list):
return
- print "Checking project rules ..."
+ print("Checking project rules ...")
debug('deps: project rules checking started')
#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)
save_samba_deps(bld, tgt_list)
- print "Project rules pass"
+ print("Project rules pass")
def CHECK_PROJECT_RULES(bld):
from TaskGen import feature, before, after
from samba_utils import *
+O755 = 493
+
@feature('install_bin')
@after('apply_core')
@before('apply_link')
# 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)
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)
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
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
import generic_cc
import samba_dist
+O644 = 420
+
# some systems have broken threading in python
if os.environ.get('WAF_NOTHREADS') == '1':
import nothreads
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)
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):
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))
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
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')
break
if not found_statfs:
- print "FATAL: Failed to find a statfs method"
+ print("FATAL: Failed to find a statfs method")
raise
list = []
-for module, package in external_libs.iteritems():
+for module, package in external_libs.items():
try:
__import__(module)
except ImportError:
# 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')
if v.startswith('with-'):
v = v[5:]
v = v.upper()
- v = string.replace(v, '-', '_')
+ v = v.replace('-', '_')
return v
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)
#!/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)
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
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
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)
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')
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):
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
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):
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)