From 80722d92812c1276b0d74ca49a21b7351ee74a69 Mon Sep 17 00:00:00 2001 From: Greg Noel Date: Sun, 8 Feb 2009 06:45:39 +0000 Subject: 2to3 sez, "rewrite map() as loop" --- QMTest/TestCmd.py | 16 +++++++--------- src/engine/SCons/Environment.py | 18 +++++++----------- src/engine/SCons/Node/FS.py | 2 +- src/engine/SCons/Tool/packaging/__init__.py | 4 +++- src/engine/SCons/Util.py | 8 ++++---- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 8b70e4c..4bf1270 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -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 diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index a92a23d..e8a1bbb 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -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)) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index e601a67..42b4023 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -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) diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py index 02be24f..3854fea 100644 --- a/src/engine/SCons/Tool/packaging/__init__.py +++ b/src/engine/SCons/Tool/packaging/__init__.py @@ -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) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index a9f7b70..d395ca8 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -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() -- cgit v0.12