[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Sep 2 01:50:03 UTC 2015


The branch, master has been updated
       via  ba6c7df build:wafsamba: Use the Waf 1.8 API get_tgen_by_name instead of name_to_obj
       via  ffea9a1 build:wafsamba: Close file handles in the build scripts too
       via  da9eee8 third_party:waf: fix a mis-merge - Utils.check_dir issue
       via  bcf5f45 third_party:waf: Backport parts of the waf 1.8 API
      from  841845d samr4: Use <SID=%s> in GetGroupsForUser

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ba6c7df7f9d0c2d54b6b7e8b423b753cb7ccac31
Author: Thomas Nagy <tnagy at waf.io>
Date:   Fri Jun 26 22:32:43 2015 +0200

    build:wafsamba: Use the Waf 1.8 API get_tgen_by_name instead of name_to_obj
    
    Signed-off-by: Thomas Nagy <tnagy at waf.io>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Sep  2 03:49:51 CEST 2015 on sn-devel-104

commit ffea9a17d775005539692b1516eb4178d6c5234a
Author: Thomas Nagy <tnagy at waf.io>
Date:   Fri Jun 26 20:48:43 2015 +0200

    build:wafsamba: Close file handles in the build scripts too
    
    Signed-off-by: Thomas Nagy <tnagy at waf.io>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit da9eee80e4bf6a00694074d1a16438420b7c09f2
Author: Thomas Nagy <tnagy at waf.io>
Date:   Fri Jun 26 20:17:06 2015 +0200

    third_party:waf: fix a mis-merge - Utils.check_dir issue
    
    Signed-off-by: Thomas Nagy <tnagy at waf.io>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit bcf5f45d8731b713be7c34b50ff3f93974eac7f3
Author: Thomas Nagy <tnagy at waf.io>
Date:   Fri Jun 26 20:13:09 2015 +0200

    third_party:waf: Backport parts of the waf 1.8 API
    
    This modifies our waf 1.5 wafadmin copy to resemble the waf 1.8
    waflib API.  It is a preparation to change to waf 1.8, decoupling
    this change from changes in wafsamba.
    
    Signed-off-by: Thomas Nagy <tnagy at waf.io>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/configure_file.py     | 10 ++----
 buildtools/wafsamba/pkgconfig.py          | 10 ++----
 buildtools/wafsamba/samba_abi.py          |  4 +--
 buildtools/wafsamba/samba_conftests.py    | 25 ++++----------
 buildtools/wafsamba/samba_deps.py         | 54 +++++++++++++++----------------
 buildtools/wafsamba/samba_optimisation.py |  4 +--
 buildtools/wafsamba/samba_patterns.py     |  5 +--
 buildtools/wafsamba/samba_pidl.py         |  2 +-
 buildtools/wafsamba/samba_utils.py        |  6 ++--
 buildtools/wafsamba/samba_version.py      |  5 +--
 buildtools/wafsamba/symbols.py            | 14 ++++----
 buildtools/wafsamba/wafsamba.py           |  4 +--
 docs-xml/wscript_build                    |  4 +--
 third_party/waf/wafadmin/Build.py         |  4 +++
 third_party/waf/wafadmin/Node.py          |  7 ++++
 third_party/waf/wafadmin/TaskGen.py       |  3 ++
 third_party/waf/wafadmin/Tools/cc.py      |  6 ++--
 third_party/waf/wafadmin/Tools/ccroot.py  | 10 +++---
 third_party/waf/wafadmin/Tools/msvc.py    |  2 +-
 third_party/waf/wafadmin/Tools/osx.py     |  6 ++--
 third_party/waf/wafadmin/Utils.py         | 44 ++++++++++++++++++-------
 21 files changed, 114 insertions(+), 115 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/configure_file.py b/buildtools/wafsamba/configure_file.py
index 8e2ba3b..21264cf 100644
--- a/buildtools/wafsamba/configure_file.py
+++ b/buildtools/wafsamba/configure_file.py
@@ -7,12 +7,8 @@ def subst_at_vars(task):
     '''substiture @VAR@ style variables in a file'''
 
     env = task.env
-    src = task.inputs[0].srcpath(env)
-    tgt = task.outputs[0].bldpath(env)
+    s = task.inputs[0].read()
 
-    f = open(src, 'r')
-    s = f.read()
-    f.close()
     # split on the vars
     a = re.split('(@\w+@)', s)
     out = []
@@ -27,9 +23,7 @@ def subst_at_vars(task):
             v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
         out.append(v)
     contents = ''.join(out)
-    f = open(tgt, 'w')
-    s = f.write(contents)
-    f.close()
+    task.outputs[0].write(contents)
     return 0
 
 def CONFIGURE_FILE(bld, in_file, **kwargs):
diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py
index 8a3f807..c837804 100644
--- a/buildtools/wafsamba/pkgconfig.py
+++ b/buildtools/wafsamba/pkgconfig.py
@@ -5,12 +5,8 @@ from samba_utils import *
 
 def subst_at_vars(task):
     '''substiture @VAR@ style variables in a file'''
-    src = task.inputs[0].srcpath(task.env)
-    tgt = task.outputs[0].bldpath(task.env)
 
-    f = open(src, 'r')
-    s = f.read()
-    f.close()
+    s = task.inputs[0].read()
     # split on the vars
     a = re.split('(@\w+@)', s)
     out = []
@@ -37,9 +33,7 @@ def subst_at_vars(task):
                     break
         out.append(v)
     contents = ''.join(out)
-    f = open(tgt, 'w')
-    s = f.write(contents)
-    f.close()
+    task.outputs[0].write(contents)
     return 0
 
 
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 76acd00..3ff6d77 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -147,12 +147,10 @@ def abi_check(self):
 
 def abi_process_file(fname, version, symmap):
     '''process one ABI file, adding new symbols to the symmap'''
-    f = open(fname, mode='r')
-    for line in f:
+    for line in Utils.readf(fname).splitlines():
         symname = line.split(":")[0]
         if not symname in symmap:
             symmap[symname] = version
-    f.close()
 
 
 def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index 96fead5..fe8c30b 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -216,9 +216,7 @@ def CHECK_NEED_LC(conf, msg):
 
     os.makedirs(subdir)
 
-    dest = open(os.path.join(subdir, 'liblc1.c'), 'w')
-    dest.write('#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n')
-    dest.close()
+    Utils.writef(os.path.join(subdir, 'liblc1.c'), '#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n')
 
     bld = Build.BuildContext()
     bld.log = conf.log
@@ -291,13 +289,8 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
 
     os.makedirs(subdir)
 
-    dest = open(os.path.join(subdir, 'lib1.c'), 'w')
-    dest.write('int lib_func(void) { return 42; }\n')
-    dest.close()
-
-    dest = open(os.path.join(dir, 'main.c'), 'w')
-    dest.write('int main(void) {return !(lib_func() == 42);}\n')
-    dest.close()
+    Utils.writef(os.path.join(subdir, 'lib1.c'), 'int lib_func(void) { return 42; }\n')
+    Utils.writef(os.path.join(dir, 'main.c'), 'int main(void) {return !(lib_func() == 42);}\n')
 
     bld = Build.BuildContext()
     bld.log = conf.log
@@ -311,9 +304,7 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
     ldflags = []
     if version_script:
         ldflags.append("-Wl,--version-script=%s/vscript" % bld.path.abspath())
-        dest = open(os.path.join(dir,'vscript'), 'w')
-        dest.write('TEST_1.0A2 { global: *; };\n')
-        dest.close()
+        Utils.writef(os.path.join(dir,'vscript'), 'TEST_1.0A2 { global: *; };\n')
 
     bld(features='cc cshlib',
         source='libdir/lib1.c',
@@ -383,15 +374,13 @@ def CHECK_PERL_MANPAGE(conf, msg=None, section=None):
     if not os.path.exists(bdir):
         os.makedirs(bdir)
 
-    dest = open(os.path.join(bdir, 'Makefile.PL'), 'w')
-    dest.write("""
+    Utils.writef(os.path.join(bdir, 'Makefile.PL'), """
 use ExtUtils::MakeMaker;
 WriteMakefile(
     'NAME'    => 'WafTest',
     'EXE_FILES' => [ 'WafTest' ]
 );
 """)
-    dest.close()
     back = os.path.abspath('.')
     os.chdir(bdir)
     proc = Utils.pproc.Popen(['perl', 'Makefile.PL'],
@@ -406,9 +395,7 @@ WriteMakefile(
         return
 
     if section:
-        f = open(os.path.join(bdir,'Makefile'), 'r')
-        man = f.read()
-        f.close()
+        man = Utils.readf(os.path.join(bdir,'Makefile'))
         m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
         if not m:
             conf.check_message_2('not found', color='YELLOW')
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index beb366b..606de41 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -47,7 +47,7 @@ def expand_subsystem_deps(bld):
         #    module_name    = rpc_epmapper (a module within the dcerpc_server subsystem)
         #    module         = rpc_epmapper (a module object within the dcerpc_server subsystem)
 
-        subsystem = bld.name_to_obj(subsystem_name, bld.env)
+        subsystem = bld.get_tgen_by_name(subsystem_name)
         bld.ASSERT(subsystem is not None, "Unable to find subsystem %s" % subsystem_name)
         for d in subsystem_list[subsystem_name]:
             module_name = d['TARGET']
@@ -101,7 +101,7 @@ def build_dependencies(self):
         self.uselib = list(self.final_syslibs)
         self.uselib.extend(list(self.direct_syslibs))
         for lib in self.final_libs:
-            t = self.bld.name_to_obj(lib, self.bld.env)
+            t = self.bld.get_tgen_by_name(lib)
             self.uselib.extend(list(t.final_syslibs))
         self.uselib = unique_list(self.uselib)
 
@@ -150,7 +150,7 @@ def build_includes(self):
     inc_abs = []
 
     for d in inc_deps:
-        t = bld.name_to_obj(d, bld.env)
+        t = bld.get_tgen_by_name(d)
         bld.ASSERT(t is not None, "Unable to find dependency %s for %s" % (d, self.sname))
         inclist = getattr(t, 'samba_includes_extended', [])[:]
         if getattr(t, 'local_include', True):
@@ -285,7 +285,7 @@ def check_duplicate_sources(bld, tgt_list):
         if not targets[t.sname] in [ 'LIBRARY', 'BINARY', 'PYTHON' ]:
             continue
         for obj in t.add_objects:
-            t2 = t.bld.name_to_obj(obj, bld.env)
+            t2 = t.bld.get_tgen_by_name(obj)
             source_set = getattr(t2, 'samba_source_set', set())
             for s in source_set:
                 if not s in subsystems:
@@ -349,7 +349,7 @@ def check_group_ordering(bld, tgt_list):
     for t in tgt_list:
         tdeps = getattr(t, 'add_objects', []) + getattr(t, 'uselib_local', [])
         for d in tdeps:
-            t2 = bld.name_to_obj(d, bld.env)
+            t2 = bld.get_tgen_by_name(d)
             if t2 is None:
                 continue
             map1 = grp_map[t.samba_group]
@@ -432,7 +432,7 @@ def build_direct_deps(bld, tgt_list):
     global_deps = bld.env.GLOBAL_DEPENDENCIES
     global_deps_exclude = set()
     for dep in global_deps:
-        t = bld.name_to_obj(dep, bld.env)
+        t = bld.get_tgen_by_name(dep)
         for d in t.samba_deps:
             # prevent loops from the global dependencies list
             global_deps_exclude.add(d)
@@ -472,7 +472,7 @@ def build_direct_deps(bld, tgt_list):
                                 implied, t.sname, targets[implied]))
                             sys.exit(1)
                 continue
-            t2 = bld.name_to_obj(d, bld.env)
+            t2 = bld.get_tgen_by_name(d)
             if t2 is None:
                 Logs.error("no task %s of type %s in %s" % (d, targets[d], t.sname))
                 sys.exit(1)
@@ -510,7 +510,7 @@ def indirect_libs(bld, t, chain, loops):
             dependency_loop(loops, t, obj)
             continue
         chain.add(obj)
-        t2 = bld.name_to_obj(obj, bld.env)
+        t2 = bld.get_tgen_by_name(obj)
         r2 = indirect_libs(bld, t2, chain, loops)
         chain.remove(obj)
         ret = ret.union(t2.direct_libs)
@@ -521,7 +521,7 @@ def indirect_libs(bld, t, chain, loops):
             dependency_loop(loops, t, obj)
             continue
         chain.add(obj)
-        t2 = bld.name_to_obj(obj, bld.env)
+        t2 = bld.get_tgen_by_name(obj)
         r2 = indirect_libs(bld, t2, chain, loops)
         chain.remove(obj)
         ret = ret.union(t2.direct_libs)
@@ -548,7 +548,7 @@ def indirect_objects(bld, t, chain, loops):
             dependency_loop(loops, t, lib)
             continue
         chain.add(lib)
-        t2 = bld.name_to_obj(lib, bld.env)
+        t2 = bld.get_tgen_by_name(lib)
         r2 = indirect_objects(bld, t2, chain, loops)
         chain.remove(lib)
         ret = ret.union(t2.direct_objects)
@@ -576,7 +576,7 @@ def extended_objects(bld, t, chain):
     for lib in t.final_libs:
         if lib in chain:
             continue
-        t2 = bld.name_to_obj(lib, bld.env)
+        t2 = bld.get_tgen_by_name(lib)
         chain.add(lib)
         r2 = extended_objects(bld, t2, chain)
         chain.remove(lib)
@@ -604,7 +604,7 @@ def includes_objects(bld, t, chain, inc_loops):
             dependency_loop(inc_loops, t, obj)
             continue
         chain.add(obj)
-        t2 = bld.name_to_obj(obj, bld.env)
+        t2 = bld.get_tgen_by_name(obj)
         r2 = includes_objects(bld, t2, chain, inc_loops)
         chain.remove(obj)
         ret = ret.union(t2.direct_objects)
@@ -615,7 +615,7 @@ def includes_objects(bld, t, chain, inc_loops):
             dependency_loop(inc_loops, t, lib)
             continue
         chain.add(lib)
-        t2 = bld.name_to_obj(lib, bld.env)
+        t2 = bld.get_tgen_by_name(lib)
         if t2 is None:
             targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
             Logs.error('Target %s of type %s not found in direct_libs for %s' % (
@@ -668,7 +668,7 @@ def break_dependency_loops(bld, tgt_list):
 
     # expand indirect subsystem and library loops
     for loop in loops.copy():
-        t = bld.name_to_obj(loop, bld.env)
+        t = bld.get_tgen_by_name(loop)
         if t.samba_type in ['SUBSYSTEM']:
             loops[loop] = loops[loop].union(t.indirect_objects)
             loops[loop] = loops[loop].union(t.direct_objects)
@@ -680,7 +680,7 @@ def break_dependency_loops(bld, tgt_list):
 
     # expand indirect includes loops
     for loop in inc_loops.copy():
-        t = bld.name_to_obj(loop, bld.env)
+        t = bld.get_tgen_by_name(loop)
         inc_loops[loop] = inc_loops[loop].union(t.includes_objects)
         if loop in inc_loops[loop]:
             inc_loops[loop].remove(loop)
@@ -726,7 +726,7 @@ def reduce_objects(bld, tgt_list):
             # if we will indirectly link to a target then we don't need it
             new = t.final_objects.copy()
             for l in t.final_libs:
-                t2 = bld.name_to_obj(l, bld.env)
+                t2 = bld.get_tgen_by_name(l)
                 t2_obj = extended_objects(bld, t2, set())
                 dup = new.intersection(t2_obj)
                 if t.sname in rely_on:
@@ -746,7 +746,7 @@ def reduce_objects(bld, tgt_list):
 
     # add back in any objects that were relied upon by the reduction rules
     for r in rely_on:
-        t = bld.name_to_obj(r, bld.env)
+        t = bld.get_tgen_by_name(r)
         t.final_objects = t.final_objects.union(rely_on[r])
 
     return True
@@ -755,7 +755,7 @@ def reduce_objects(bld, tgt_list):
 def show_library_loop(bld, lib1, lib2, path, seen):
     '''show the detailed path of a library loop between lib1 and lib2'''
 
-    t = bld.name_to_obj(lib1, bld.env)
+    t = bld.get_tgen_by_name(lib1)
     if not lib2 in getattr(t, 'final_libs', set()):
         return
 
@@ -794,7 +794,7 @@ def calculate_final_deps(bld, tgt_list, loops):
             # replace lib deps with objlist deps
             for l in t.final_libs:
                 objname = l + '.objlist'
-                t2 = bld.name_to_obj(objname, bld.env)
+                t2 = bld.get_tgen_by_name(objname)
                 if t2 is None:
                     Logs.error('ERROR: subsystem %s not found' % objname)
                     sys.exit(1)
@@ -810,7 +810,7 @@ def calculate_final_deps(bld, tgt_list, loops):
                             objname = module_name
                         else:
                             continue
-                        t2 = bld.name_to_obj(objname, bld.env)
+                        t2 = bld.get_tgen_by_name(objname)
                         if t2 is None:
                             Logs.error('ERROR: subsystem %s not found' % objname)
                             sys.exit(1)
@@ -822,7 +822,7 @@ def calculate_final_deps(bld, tgt_list, loops):
     for t in tgt_list:
         if t.samba_type in ['LIBRARY', 'PYTHON']:
             for l in t.final_libs.copy():
-                t2 = bld.name_to_obj(l, bld.env)
+                t2 = bld.get_tgen_by_name(l)
                 if t.sname in t2.final_libs:
                     if getattr(bld.env, "ALLOW_CIRCULAR_LIB_DEPENDENCIES", False):
                         # we could break this in either direction. If one of the libraries
@@ -856,7 +856,7 @@ def calculate_final_deps(bld, tgt_list, loops):
                         diff.remove(t.sname)
                     # make sure we don't recreate the loop again!
                     for d in diff.copy():
-                        t2 = bld.name_to_obj(d, bld.env)
+                        t2 = bld.get_tgen_by_name(d)
                         if t2.samba_type == 'LIBRARY':
                             if t.sname in t2.final_libs:
                                 debug('deps: removing expansion %s from %s', d, t.sname)
@@ -881,12 +881,12 @@ def calculate_final_deps(bld, tgt_list, loops):
             continue
         syslibs = set()
         for d in t.final_objects:
-            t2 = bld.name_to_obj(d, bld.env)
+            t2 = bld.get_tgen_by_name(d)
             syslibs = syslibs.union(t2.direct_syslibs)
         # this adds the indirect syslibs as well, which may not be needed
         # depending on the linker flags
         for d in t.final_libs:
-            t2 = bld.name_to_obj(d, bld.env)
+            t2 = bld.get_tgen_by_name(d)
             syslibs = syslibs.union(t2.direct_syslibs)
         t.final_syslibs = syslibs
 
@@ -896,7 +896,7 @@ def calculate_final_deps(bld, tgt_list, loops):
     for t in tgt_list:
         if t.samba_type in ['LIBRARY', 'PYTHON']:
             for l in t.final_libs.copy():
-                t2 = bld.name_to_obj(l, bld.env)
+                t2 = bld.get_tgen_by_name(l)
                 if t.sname in t2.final_libs:
                     Logs.error('ERROR: Unresolved library loop %s from %s' % (t.sname, t2.sname))
                     lib_loop_error = True
@@ -912,7 +912,7 @@ def show_dependencies(bld, target, seen):
     if target in seen:
         return
 
-    t = bld.name_to_obj(target, bld.env)
+    t = bld.get_tgen_by_name(target)
     if t is None:
         Logs.error("ERROR: Unable to find target '%s'" % target)
         sys.exit(1)
@@ -941,7 +941,7 @@ def show_object_duplicates(bld, tgt_list):
         if not targets[t.sname] in [ 'LIBRARY', 'PYTHON' ]:
             continue
         for n in getattr(t, 'final_objects', set()):
-            t2 = bld.name_to_obj(n, bld.env)
+            t2 = bld.get_tgen_by_name(n)
             if not n in used_by:
                 used_by[n] = set()
             used_by[n].add(t.sname)
diff --git a/buildtools/wafsamba/samba_optimisation.py b/buildtools/wafsamba/samba_optimisation.py
index 51d514e..43b12a2 100644
--- a/buildtools/wafsamba/samba_optimisation.py
+++ b/buildtools/wafsamba/samba_optimisation.py
@@ -165,7 +165,7 @@ def is_this_a_static_lib(self, name):
     try:
         return cache[name]
     except KeyError:
-        ret = cache[name] = 'cstaticlib' in self.bld.name_to_obj(name, self.env).features
+        ret = cache[name] = 'cstaticlib' in self.bld.get_tgen_by_name(name).features
         return ret
 TaskGen.task_gen.is_this_a_static_lib = is_this_a_static_lib
 
@@ -215,7 +215,7 @@ def apply_lib_vars(self):
         if lib_name in seen:
             continue
 
-        y = self.name_to_obj(lib_name)
+        y = self.get_tgen_by_name(lib_name)
         if not y:
             raise Utils.WafError('object %r was not found in uselib_local (required by %r)' % (lib_name, self.name))
         y.post()
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index 0469992..5183e86 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -8,14 +8,11 @@ from wafsamba import samba_version_file
 def write_version_header(task):
     '''print version.h contents'''
     src = task.inputs[0].srcpath(task.env)
-    tgt = task.outputs[0].bldpath(task.env)
 
     version = samba_version_file(src, task.env.srcdir, env=task.env, is_install=task.env.is_install)
     string = str(version)
 
-    f = open(tgt, 'w')
-    s = f.write(string)
-    f.close()
+    task.outputs[0].write(string)
     return 0
 
 
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index 110b15e..abf6e9c 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -118,7 +118,7 @@ from TaskGen import feature, before
 def collect(self):
     pidl_headers = LOCAL_CACHE(self.bld, 'PIDL_HEADERS')
     for (name, hd) in pidl_headers.items():
-        y = self.bld.name_to_obj(name, self.env)
+        y = self.bld.get_tgen_by_name(name)
         self.bld.ASSERT(y is not None, 'Failed to find PIDL header %s' % name)
         y.post()
         for node in hd:
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 540fe44..9bbe6ac 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -66,7 +66,7 @@ def ADD_LD_LIBRARY_PATH(path):
 def needs_private_lib(bld, target):
     '''return True if a target links to a private library'''
     for lib in getattr(target, "final_libs", []):
-        t = bld.name_to_obj(lib, bld.env)
+        t = bld.get_tgen_by_name(lib)
         if t and getattr(t, 'private_library', False):
             return True
     return False
@@ -173,7 +173,7 @@ def process_depends_on(self):
     if getattr(self , 'depends_on', None):
         lst = self.to_list(self.depends_on)
         for x in lst:
-            y = self.bld.name_to_obj(x, self.env)
+            y = self.bld.get_tgen_by_name(x)
             self.bld.ASSERT(y is not None, "Failed to find dependency %s of %s" % (x, self.name))
             y.post()
             if getattr(y, 'more_includes', None):
@@ -644,7 +644,7 @@ def get_tgt_list(bld):
         type = targets[tgt]
         if not type in ['SUBSYSTEM', 'MODULE', 'BINARY', 'LIBRARY', 'ASN1', 'PYTHON']:
             continue
-        t = bld.name_to_obj(tgt, bld.env)
+        t = bld.get_tgen_by_name(tgt)
         if t is None:
             Logs.error("Target %s of type %s has no task generator" % (tgt, type))
             sys.exit(1)
diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
index bb0be96..950a855 100644
--- a/buildtools/wafsamba/samba_version.py
+++ b/buildtools/wafsamba/samba_version.py
@@ -42,12 +42,10 @@ def git_version_summary(path, env=None):
 
 def distversion_version_summary(path):
     #get version from .distversion file
-    f = open(path + '/.distversion', 'r')
     suffix = None
     fields = {}
 
-    for line in f:
-        line = line.strip()
+    for line in Utils.readf(path + '/.distversion').splitlines():
         if line == '':
             continue
         if line.startswith("#"):
@@ -64,7 +62,6 @@ def distversion_version_summary(path):
         except:
             print("Failed to parse line %s from .distversion file." % (line))
             raise
-    f.close()
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list