diff options
-rwxr-xr-x | scripts/main_loop.py | 50 | ||||
-rw-r--r-- | scripts/phase.py | 6 |
2 files changed, 28 insertions, 28 deletions
diff --git a/scripts/main_loop.py b/scripts/main_loop.py index cacf349..a77b2cf 100755 --- a/scripts/main_loop.py +++ b/scripts/main_loop.py @@ -16,14 +16,14 @@ import iteration def step(): phs = phase.get() - if phs == phase.phs("Not Initialized"): + if phs == 0: try: os.mkdir(conf.build_folder) except FileExistsError: pass phase.set(1) - elif phs == phase.phs("Initializing"): - print("-- Initializing ...") + elif phs == 1: + phase.message(1) initialize.kconfig_parser() try: initialize.gen_requred() @@ -31,41 +31,37 @@ def step(): pass iteration.reset() phase.set(2) - elif phs == phase.phs("Initialized"): - print("-- Initialized") + elif phs == 2: + phase.message(2) phase.set(3) - elif phs == phase.phs("Solution generating"): - print("-- Generating solution ...") + elif phs == 3: + phase.message(3) solution.generate() iteration.inc() phase.set(4) - elif phs == phase.phs("Solution generated"): - print("-- Solution generated") + elif phs == 4: + phase.message(4) phase.set(5) - elif phs == phase.phs("Solution applying"): - print("-- Applying generated solution ...") + elif phs == 5: + phase.message(5) solution.apply() phase.set(6) - elif phs == phase.phs("Solution applied"): - print("-- Generated solution applied") + elif phs == 6: + phase.message(6) phase.set(7) - elif phs == phase.phs("Kernel configuration"): - print("-- Kernel configure ...") - try: - kernel.config() - phase.set(8) - except KernelConfigFailed: - print("-- Kernel configuration failed") - phase.set(3) - elif phs == phase.phs("Kernel configured"): - print("-- Kernel configured") + elif phs == 7: + phase.message(7) + kernel.config() + phase.set(8) + elif phs == 8: + phase.message(8) phase.set(9) - elif phs == phase.phs("Kernel build"): - print("-- Build Linux ...") + elif phs == 9: + phase.message(9) kernel.make() phase.set(10) - elif phs == phase.phs("Kernel built"): - print("-- Linux built") + elif phs == 10: + phase.message(10) phase.set(2) class mainThread(Thread): diff --git a/scripts/phase.py b/scripts/phase.py index 6578b13..4da61b1 100644 --- a/scripts/phase.py +++ b/scripts/phase.py @@ -3,7 +3,7 @@ import sys from conf import conf -phases = ("Not Initialized", #0 +phases = ("Not Initialized" #0 "Initializing", #1 "Initialized", #2 "Solution generating", #3 @@ -35,3 +35,7 @@ def pset(str): def phs(str): return phases.index(str) + +def message(phs): + "Prints message signaling running phase." + print("-- " + phases[phs]) |