diff options
author | Steven Knight <knight@baldmt.com> | 2006-01-21 18:09:35 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-01-21 18:09:35 (GMT) |
commit | 9e51adb1a538111d3661e07e04ecc112370ab6f2 (patch) | |
tree | ae6ba34325a0ac68a24624c6705e84983ed0e1f4 | |
parent | 222e96534b47d6a14167b2938212d1933d27eec9 (diff) | |
download | SCons-9e51adb1a538111d3661e07e04ecc112370ab6f2.zip SCons-9e51adb1a538111d3661e07e04ecc112370ab6f2.tar.gz SCons-9e51adb1a538111d3661e07e04ecc112370ab6f2.tar.bz2 |
Refactor NodeInfo decisions in anticipation of bigger refctoring.
-rw-r--r-- | src/engine/SCons/Node/FS.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index a0a7a44..3d70c7c 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1974,6 +1974,18 @@ class File(Base): # # + def is_up_to_date(self, node=None, bi=None): + """Returns if the node is up-to-date with respect to stored + BuildInfo. The default is to compare it against our own + previously stored BuildInfo, but the stored BuildInfo from another + Node (typically one in a Repository) can be used instead.""" + if bi is None: + if node is None: + node = self + bi = node.get_stored_info() + new = self.get_binfo() + return new == bi + def current(self, calc=None): self.binfo = self.gen_binfo(calc) return self._cur2() @@ -1986,20 +1998,16 @@ class File(Base): r = self.rfile() if r != self: # ...but there is one in a Repository... - old = r.get_stored_info() - new = self.get_binfo() - if new == old: + if self.is_up_to_date(r): # ...and it's even up-to-date... if self._local: # ...and they'd like a local copy. LocalCopy(self, r, None) - self.store_info(new) + self.store_info(self.get_binfo()) return 1 return None else: - old = self.get_stored_info() - new = self.get_binfo() - return (new == old) + return self.is_up_to_date() def rfile(self): "__cacheable__" |