diff options
-rwxr-xr-x | scripts/initialize.py | 8 | ||||
-rw-r--r-- | scripts/solution.py | 31 |
2 files changed, 21 insertions, 18 deletions
diff --git a/scripts/initialize.py b/scripts/initialize.py index fa2492d..35510d2 100755 --- a/scripts/initialize.py +++ b/scripts/initialize.py @@ -11,13 +11,18 @@ import exceptions import loop import solution +import exceptions + def all(): base() gen_nbscript() parse_kconfig() gen_requred() if conf.gen_all_solution_oninit: - solution.generate() + try: + solution.generate() + except exceptions.NoSolution: + pass def base(): print('Initialize base...') @@ -75,7 +80,6 @@ def gen_requred(): freq.write(str(srmap[line[7:indx]]) + "\n") elif (line[indx + 1] == 'n' or line[indx + 1] == 'm'): freq.write("-" + str(srmap[line[7:indx]]) + "\n") - freq.write("-" + str(srmap["MODULES"]) + "\n"); # force modules no def gen_nbscript(): diff --git a/scripts/solution.py b/scripts/solution.py index 1ee1664..61cf65c 100644 --- a/scripts/solution.py +++ b/scripts/solution.py @@ -70,22 +70,21 @@ def generate(): if conf.picosat_output: print(line, end="") if line[0] == 's': - if line.rstrip() == 's SATISFIABLE': - try: - solut.remove(0) - with open(sf(conf.config_map_file), 'a') as fm: - fm.write(str(utils.hash_config(solut)) + ':') - for sl in solut: - fm.write(str(sl) + ' ') - fm.write('\n') - with open(sf(conf.solved_file), 'a') as fs: - for sl in solut: - fs.write(str(-1 * sl) + ' ') - fs.write('\n') - except ValueError: - pass - solut = [] - else: + try: + solut.remove(0) + with open(sf(conf.config_map_file), 'a') as fm: + fm.write(str(utils.hash_config(solut)) + ':') + for sl in solut: + fm.write(str(sl) + ' ') + fm.write('\n') + with open(sf(conf.solved_file), 'a') as fs: + for sl in solut: + fs.write(str(-1 * sl) + ' ') + fs.write('\n') + except ValueError: + pass + solut = [] + if not line.rstrip() == 's SATISFIABLE': os.remove(w_file.name) raise exceptions.NoSolution() elif line[0] == 'v': |