Oops, earlier state.mark() stuff was a little too radical.
If someone else built and marked one of our dependencies, then that dependency would show up as *clean* in a later redo-ifchange, so other dependents of that file wouldn't be rebuilt. We actually have to track two session-specific variables: whether the file has been checked, and whether it was rebuilt. (Or alternatively, whether it was dirty when we checked it the first time. But we store the former.)
This commit is contained in:
parent
cd702a8126
commit
0652bc9911
2 changed files with 36 additions and 5 deletions
22
state.py
22
state.py
|
|
@ -13,6 +13,8 @@ def init():
|
|||
os.unlink(f)
|
||||
for f in glob.glob('%s/.redo/mark^*' % vars.BASE):
|
||||
os.unlink(f)
|
||||
for f in glob.glob('%s/.redo/built^*' % vars.BASE):
|
||||
os.unlink(f)
|
||||
|
||||
|
||||
def _sname(typ, t, fromdir=None):
|
||||
|
|
@ -46,6 +48,7 @@ def _stampname(t, fromdir=None):
|
|||
|
||||
|
||||
def stamp(t):
|
||||
built(t)
|
||||
mark(t)
|
||||
stampfile = _stampname(t)
|
||||
newstampfile = _sname('stamp' + str(os.getpid()), t)
|
||||
|
|
@ -78,6 +81,25 @@ def stamped(t, fromdir=None):
|
|||
return stamptime
|
||||
|
||||
|
||||
def built(t, fromdir=None):
|
||||
try:
|
||||
open(_sname('built', t, fromdir), 'w').close()
|
||||
except IOError, e:
|
||||
if e.errno == errno.ENOENT:
|
||||
pass # may happen if someone deletes our .redo dir
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
_builts = {}
|
||||
def isbuilt(t, fromdir=None):
|
||||
if _builts.get((t,fromdir)):
|
||||
return True
|
||||
if os.path.exists(_sname('built', t, fromdir)):
|
||||
_builts[(t,fromdir)] = True
|
||||
return True
|
||||
|
||||
|
||||
def mark(t, fromdir=None):
|
||||
try:
|
||||
open(_sname('mark', t, fromdir), 'w').close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue