2to3 sez, "rewrite map() as loop"
authorGregNoel <GregNoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 8 Feb 2009 06:45:39 +0000 (06:45 +0000)
committerGregNoel <GregNoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 8 Feb 2009 06:45:39 +0000 (06:45 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@3981 fdb21ef1-2011-0410-befe-b5e4ea1792b1

QMTest/TestCmd.py
src/engine/SCons/Environment.py
src/engine/SCons/Node/FS.py
src/engine/SCons/Tool/packaging/__init__.py
src/engine/SCons/Util.py

index 8b70e4c9847dacf26899a55099d52c1df97baa6c..4bf12707f0744cd8d037eac0eab48906e7fd4f8a 100644 (file)
@@ -1335,9 +1335,8 @@ class TestCmd:
             do_chmod(top)
 
             def chmod_entries(arg, dirname, names, do_chmod=do_chmod):
-                pathnames = map(lambda n, d=dirname: os.path.join(d, n),
-                                names)
-                map(lambda p, do=do_chmod: do(p), pathnames)
+                for n in names:
+                    do_chmod(os.path.join(dirname, n))
 
             os.path.walk(top, chmod_entries, None)
         else:
@@ -1352,7 +1351,7 @@ class TestCmd:
             col = Collector(top)
             os.path.walk(top, col, None)
             col.entries.reverse()
-            map(lambda d, do=do_chmod: do(d), col.entries)
+            for d in col.entries: do_chmod(d)
 
     def writable(self, top, write=1):
         """Make the specified directory tree writable (write == 1)
@@ -1388,7 +1387,7 @@ class TestCmd:
         else:
             col = Collector(top)
             os.path.walk(top, col, None)
-            map(lambda d, do=do_chmod: do(d), col.entries)
+            for d in col.entries: do_chmod(d)
 
     def executable(self, top, execute=1):
         """Make the specified directory tree executable (execute == 1)
@@ -1425,9 +1424,8 @@ class TestCmd:
             do_chmod(top)
 
             def chmod_entries(arg, dirname, names, do_chmod=do_chmod):
-                pathnames = map(lambda n, d=dirname: os.path.join(d, n),
-                                names)
-                map(lambda p, do=do_chmod: do(p), pathnames)
+                for n in names:
+                    do_chmod(os.path.join(dirname, n))
 
             os.path.walk(top, chmod_entries, None)
         else:
@@ -1442,7 +1440,7 @@ class TestCmd:
             col = Collector(top)
             os.path.walk(top, col, None)
             col.entries.reverse()
-            map(lambda d, do=do_chmod: do(d), col.entries)
+            for d in col.entries: do_chmod(d)
 
     def write(self, file, content, mode = 'wb'):
         """Writes the specified content text (second argument) to the
index a92a23d4ba275dfb6c627700a90fa9bc1cf333f4..e8a1bbbbc64b71cd874eaa09907456d1d17f09f3 100644 (file)
@@ -2132,17 +2132,13 @@ class Base(SubstitutionEnvironment):
         #            result.append(s)
         build_source(node.all_children(), sources)
 
-        # now strip the build_node from the sources by calling the srcnode
-        # function
-        def get_final_srcnode(file):
-            srcnode = file.srcnode()
-            while srcnode != file.srcnode():
-                srcnode = file.srcnode()
-            return srcnode
-
-        # get the final srcnode for all nodes, this means stripping any
-        # attached build node.
-        map( get_final_srcnode, sources )
+    # THIS CODE APPEARS TO HAVE NO EFFECT
+    #    # get the final srcnode for all nodes, this means stripping any
+    #    # attached build node by calling the srcnode function
+    #    for file in sources:
+    #        srcnode = file.srcnode()
+    #        while srcnode != file.srcnode():
+    #            srcnode = file.srcnode()
 
         # remove duplicates
         return list(set(sources))
index e601a6700271d618eaa710b3981b320489220b3d..42b402333136ab9f452d88c25f95de3130f58432 100644 (file)
@@ -1959,7 +1959,7 @@ class Dir(Base):
             if not strings:
                 # Make sure the working directory (self) actually has
                 # entries for all Nodes in repositories or variant dirs.
-                map(selfEntry, node_names)
+                for name in node_names: selfEntry(name)
             if ondisk:
                 try:
                     disk_names = os.listdir(dir.abspath)
index 02be24f0639824d3a5ca8c892f90cd7b502b3c06..3854fea337fddd4a8f78c0bc98c3e717aa3b3b63 100644 (file)
@@ -169,7 +169,9 @@ def Package(env, target=None, source=None, **kw):
         args,varargs,varkw,defaults=getargspec(packager.package)
         if defaults!=None:
             args=args[:-len(defaults)] # throw away arguments with default values
-        map(args.remove, 'env target source'.split())
+        args.remove('env')
+        args.remove('target')
+        args.remove('source')
         # now remove any args for which we have a value in kw.
         #args=[x for x in args if not kw.has_key(x)]
         args=filter(lambda x, kw=kw: not kw.has_key(x), args)
index a9f7b70baf1bc8d32e6299dddbef0b8aa0ecc507..d395ca8b818f5c73b66712c82fd3cc4ab2bc3b88 100644 (file)
@@ -287,11 +287,11 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}):
 
     if children:
         margin.append(1)
-        map(lambda C, cf=child_func, p=prune, i=IDX(showtags), m=margin, v=visited:
-                   print_tree(C, cf, p, i, m, v),
-            children[:-1])
+        idx = IDX(showtags)
+        for C in children[:-1]:
+            print_tree(C, child_func, prune, idx, margin, visited)
         margin[-1] = 0
-        print_tree(children[-1], child_func, prune, IDX(showtags), margin, visited)
+        print_tree(children[-1], child_func, prune, idx, margin, visited)
         margin.pop()