From ef85245f159402fd948ff045b56ad9095d22b39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 3 Feb 2015 20:57:20 +0100 Subject: Implementing main loop These new scripts are part of main loop. kernel is not finished!! Divides kconfig_parser, sat_solution to better named modules. Phasing and iteration is implemented for loop watching. --- scripts/phase.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/phase.py (limited to 'scripts/phase.py') diff --git a/scripts/phase.py b/scripts/phase.py new file mode 100644 index 0000000..6578b13 --- /dev/null +++ b/scripts/phase.py @@ -0,0 +1,37 @@ +import os +import sys + +from conf import conf + +phases = ("Not Initialized", #0 + "Initializing", #1 + "Initialized", #2 + "Solution generating", #3 + "Solution generated", #4 + "Solution applying", #5 + "Solution applied", #6 + "Kernel configuration", #7 + "Kernel configured", #8 + "Kernel build", #9 + "Kernel built" #10 + ) + +def get(): + try: + with open(conf.phase_file) as f: + txtPhase = f.readline().rstrip() + if not txtPhase in phases: + raise PhaseMismatch() + return phases.index(txtPhase) + except FileNotFoundError: + return 0 + +def set(phs): + with open(conf.phase_file, 'w') as f: + f.write(phases[phs]) + +def pset(str): + set(phase.index(str)) + +def phs(str): + return phases.index(str) -- cgit v1.2.3