waf: fixed some python3.x portability issues
authorAndrew Tridgell <tridge@samba.org>
Wed, 6 Oct 2010 09:11:01 +0000 (20:11 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 6 Oct 2010 11:13:05 +0000 (11:13 +0000)
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
buildtools/wafsamba/samba_utils.py
buildtools/wafsamba/samba_version.py
buildtools/wafsamba/wafsamba.py
pidl/wscript
source4/scripting/wscript_build
source4/setup/wscript_build

index 05ea56cc47ec8caeca7128a7a31429f875958b44..dda44cd0122fe516130c5fc1c9cee4a4871aaa3b 100644 (file)
@@ -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)
 
 
 
index d466cfaadaf8952f121b5b0a658e8ed959eecc6b..7ce9f757e956fb6051b12fd9c0d9e4500106980a 100644 (file)
@@ -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'''
index 82f882f64626faf399bc0615823550fc98407e79..735a70002dbad53986ad9f89db126cb3f817d520 100644 (file)
@@ -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)
index da046e17a0ca2999f498f377c741fac0cf10e1ef..262d3bdc9821ed308a4fa6dda651784121e971e3 100644 (file)
@@ -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))
index f2b65c864b2c366ad0b8923b5f9bcdde98571b39..8cb0c6f5b3d50ef7a5214681e9c0431a75eb46fb 100644 (file)
@@ -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')
 
index 8d1b1681356c1c84de34c2fd405f5cd171eea80f..76ff739c9e7229d9377fc946080f5eefa81d4c97 100644 (file)
@@ -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)
index f337e6f5267a5875f6fb2d3903c51eb126c6a4ad..241e8b8686105f6176803d22da3927feba903a2c 100644 (file)
@@ -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')