summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-03-06 03:44:32 (GMT)
committerGreg Ward <gward@python.net>2000-03-06 03:44:32 (GMT)
commit9552665436eb477e9c1f73270dc8ee4cb188bacf (patch)
treef85365d95e99951b1cb5e03b362e49c822c66247 /Lib
parent32c4a8a0ee74ab932c693de3c8658f4fe57c1ca9 (diff)
downloadcpython-9552665436eb477e9c1f73270dc8ee4cb188bacf.zip
cpython-9552665436eb477e9c1f73270dc8ee4cb188bacf.tar.gz
cpython-9552665436eb477e9c1f73270dc8ee4cb188bacf.tar.bz2
Rewrote 'newer_pairwise(): more natural (and incompatible) interface,
simpler implementation.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/util.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index b20f5be..03c0c88 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -100,22 +100,23 @@ def newer (source, target):
def newer_pairwise (sources, targets):
- """Walk two filename lists in parallel, testing if each 'target' is
- up-to-date relative to its corresponding 'source'. If so, both
- are deleted from their respective lists. Return a list of tuples
- containing the deleted (source,target) pairs."""
+ """Walk two filename lists in parallel, testing if each source is newer
+ than its corresponding target. Return a pair of lists (sources,
+ targets) where source is newer than target, according to the
+ semantics of 'newer()'."""
if len (sources) != len (targets):
raise ValueError, "'sources' and 'targets' must be same length"
- goners = []
- for i in range (len (sources)-1, -1, -1):
- if not newer (sources[i], targets[i]):
- goners.append ((sources[i], targets[i]))
- del sources[i]
- del targets[i]
- goners.reverse()
- return goners
+ # build a pair of lists (sources, targets) where source is newer
+ n_sources = []
+ n_targets = []
+ for i in range (len (sources)):
+ if newer (sources[i], targets[i]):
+ n_sources.append (sources[i])
+ n_targets.append (targets[i])
+
+ return (n_sources, n_targets)
# newer_pairwise ()