Move env.{add,get}_lock() into cycles.py, and rename.

They really aren't locks at all, they're a cycle detector.  Also rename
REDO_LOCKS to a more meaningful REDO_CYCLES.  And we'll move the
CyclicDependencyError exception in here as well, instead of state.py
where it doesn't really belong.
This commit is contained in:
Avery Pennarun 2018-12-05 00:18:07 -05:00
commit f1305b49eb
5 changed files with 32 additions and 25 deletions

View file

@ -1,5 +1,5 @@
import os
import env, state
import cycles, env, state
from logs import debug
CLEAN = 0
@ -11,7 +11,7 @@ def isdirty(f, depth, max_changed,
set_checked=state.File.set_checked_save,
log_override=state.warn_override):
if f.id in already_checked:
raise state.CyclicDependencyError()
raise cycles.CyclicDependencyError()
# make a copy of the list, so upon returning, our parent's copy
# is unaffected
already_checked = list(already_checked) + [f.id]