builder.py: now the only exported function is main().

We can also avoid forking altogether if should_build() returns false.  This
doesn't seem to result in any noticeable speedup, but it's cleaner at least.
This commit is contained in:
Avery Pennarun 2010-11-21 23:33:11 -08:00
commit 3209316856
3 changed files with 36 additions and 27 deletions

View file

@ -45,11 +45,6 @@ def should_build(t):
return not state.isbuilt(t) and dirty_deps(t, depth = '')
def maybe_build(t):
if should_build(t):
return builder.build(t)
if not vars.TARGET:
err('redo-ifchange: error: must be run from inside a .do\n')
sys.exit(100)
@ -57,13 +52,10 @@ if not vars.TARGET:
rv = 202
try:
try:
want_build = []
for t in sys.argv[1:]:
targets = sys.argv[1:]
for t in targets:
state.add_dep(vars.TARGET, 'm', t)
if should_build(t):
want_build.append(t)
rv = builder.main(want_build, maybe_build)
rv = builder.main(targets, should_build)
finally:
jwack.force_return_tokens()
except KeyboardInterrupt: