diff options
| author | Steven Knight <knight@baldmt.com> | 2003-03-02 02:43:16 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-03-02 02:43:16 (GMT) |
| commit | ec3e478f83215dd7487daa70f1c0287d12e82f39 (patch) | |
| tree | 6135096eda6c72b844a8d95cf00e01ea77fcda17 /src/engine/SCons/Environment.py | |
| parent | c03ac136007521fda90a7963baa4956d950b9363 (diff) | |
| download | SCons-ec3e478f83215dd7487daa70f1c0287d12e82f39.zip SCons-ec3e478f83215dd7487daa70f1c0287d12e82f39.tar.gz SCons-ec3e478f83215dd7487daa70f1c0287d12e82f39.tar.bz2 | |
Fix using more than two targets or sources in a list.
Diffstat (limited to 'src/engine/SCons/Environment.py')
| -rw-r--r-- | src/engine/SCons/Environment.py | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 6857109..fdfa8b2 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -542,4 +542,38 @@ class Environment: if name[-len(old_suffix):] == old_suffix: name = name[:-len(old_suffix)] return os.path.join(dir, new_prefix+name+new_suffix) - + + def sig_dict(self): + """Supply a dictionary for use in computing signatures. + + This fills in static TARGET, TARGETS, SOURCE and SOURCES + variables so that signatures stay the same every time. + """ + class lister: + def __init__(self, fmt): + self.fmt = fmt + def _format(self, index): + # For some reason, I originally made the fake names of + # the targets and sources 1-based (['__t1__, '__t2__']), + # not 0-based. We preserve this behavior by adding one + # to the returned item names, so everyone's targets + # won't get recompiled if they were using an old + # version. + return self.fmt % (index + 1) + def __str__(self): + return self._format(0) + " " + self._format(1) + def __getitem__(self, index): + return SCons.Util.PathList([self._format(index)])[0] + def __getslice__(self, i, j): + slice = [] + for x in range(i, j): + slice.append(self._format(x)) + return SCons.Util.PathList(slice) + + dict = {} + for k,v in self.items(): dict[k] = v + dict['TARGETS'] = lister('__t%d__') + dict['TARGET'] = dict['TARGETS'][0] + dict['SOURCES'] = lister('__s%d__') + dict['SOURCE'] = dict['SOURCES'][0] + return dict |
