From c24240bcd2f833321f45ea4ce0b6c6d080a3b990 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 6 Oct 2010 20:11:01 +1100 Subject: [PATCH] waf: fixed some python3.x portability issues these have crept into the tree over time. Maybe we should add testing of a range of python versions to autobuild? --- buildtools/wafsamba/samba_install.py | 2 +- buildtools/wafsamba/samba_utils.py | 4 ++++ buildtools/wafsamba/samba_version.py | 2 +- buildtools/wafsamba/wafsamba.py | 6 +++--- pidl/wscript | 3 ++- source4/scripting/wscript_build | 7 ++++--- source4/setup/wscript_build | 4 +++- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py index 05ea56cc47..dda44cd012 100644 --- a/buildtools/wafsamba/samba_install.py +++ b/buildtools/wafsamba/samba_install.py @@ -41,7 +41,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=MODE_755) diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index d466cfaada..7ce9f757e9 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -11,6 +11,10 @@ import shlex LIB_PATH="shared" +# sigh, python octal constants are a mess +MODE_644 = int('644', 8) +MODE_755 = int('755', 8) + @conf def SET_TARGET_TYPE(ctx, target, value): '''set the target type of a target''' diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 82f882f646..735a70002d 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -173,7 +173,7 @@ class samba_version_file(samba_version): value = split_line[1].strip('"') version_dict[split_line[0]] = value except: - print "Failed to parse line %s from %s" % (line, version_file) + print("Failed to parse line %s from %s" % (line, version_file)) raise super(samba_version_file, self).__init__(version_dict, have_git=have_git) diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index da046e17a0..262d3bdc98 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -573,7 +573,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=MODE_644, flat=False, python_fixup=False, destname=None, base_name=None): '''install a file''' destdir = bld.EXPAND_VARIABLES(destdir) @@ -601,7 +601,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=MODE_644, flat=False, python_fixup=False, destname=None, base_name=None): '''install a set of files''' for f in TO_LIST(files): @@ -611,7 +611,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=MODE_644, 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)) diff --git a/pidl/wscript b/pidl/wscript index f2b65c864b..8cb0c6f5b3 100644 --- a/pidl/wscript +++ b/pidl/wscript @@ -1,6 +1,7 @@ #!/usr/bin/env python import os +from samba_utils import MODE_755 def set_options(opt): opt.tool_options('perl') @@ -18,7 +19,7 @@ def configure(conf): conf.find_program('pod2man', var='POD2MAN') def build(bld): - bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=0755) + bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=MODE_755) bld.RECURSE('lib') diff --git a/source4/scripting/wscript_build b/source4/scripting/wscript_build index 8d1b168135..76ff739c9e 100644 --- a/source4/scripting/wscript_build +++ b/source4/scripting/wscript_build @@ -1,7 +1,8 @@ #!/usr/bin/env python +from samba_utils import MODE_755 + bld.INSTALL_FILES('${SBINDIR}','bin/upgradeprovision bin/samba_dnsupdate bin/samba_spnupdate', - chmod=0755, python_fixup=True, flat=True) + chmod=MODE_755, python_fixup=True, flat=True) bld.INSTALL_FILES('${BINDIR}','bin/testparm', - chmod=0755, python_fixup=True, flat=True) - + chmod=MODE_755, python_fixup=True, flat=True) diff --git a/source4/setup/wscript_build b/source4/setup/wscript_build index f337e6f526..241e8b8686 100644 --- a/source4/setup/wscript_build +++ b/source4/setup/wscript_build @@ -1,9 +1,11 @@ #!/usr/bin/env python +from samba_utils import MODE_755 + bld.INSTALL_WILDCARD('${SETUPDIR}', 'ad-schema/*.txt') bld.INSTALL_WILDCARD('${SETUPDIR}', 'display-specifiers/*.txt') -bld.INSTALL_FILES('${SBINDIR}', 'provision', chmod=0755, python_fixup=True) +bld.INSTALL_FILES('${SBINDIR}', 'provision', chmod=MODE_755, python_fixup=True) bld.INSTALL_FILES('${SETUPDIR}', 'dns_update_list') bld.INSTALL_FILES('${SETUPDIR}', 'spn_update_list') -- 2.34.1