]>
Commit | Line | Data |
---|---|---|
53e6db90 DC |
1 | from distutils.dep_util import newer_group |
2 | ||
3 | ||
4 | # yes, this is was almost entirely copy-pasted from | |
5 | # 'newer_pairwise()', this is just another convenience | |
6 | # function. | |
7 | def newer_pairwise_group(sources_groups, targets): | |
8 | """Walk both arguments in parallel, testing if each source group is newer | |
9 | than its corresponding target. Returns a pair of lists (sources_groups, | |
10 | targets) where sources is newer than target, according to the semantics | |
11 | of 'newer_group()'. | |
12 | """ | |
13 | if len(sources_groups) != len(targets): | |
14 | raise ValueError( | |
15 | "'sources_group' and 'targets' must be the same length") | |
16 | ||
17 | # build a pair of lists (sources_groups, targets) where source is newer | |
18 | n_sources = [] | |
19 | n_targets = [] | |
20 | for i in range(len(sources_groups)): | |
21 | if newer_group(sources_groups[i], targets[i]): | |
22 | n_sources.append(sources_groups[i]) | |
23 | n_targets.append(targets[i]) | |
24 | ||
25 | return n_sources, n_targets |