diff options
author | Karel Kočí <cynerd@email.cz> | 2015-02-03 20:57:20 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-02-03 20:57:20 +0100 |
commit | ef85245f159402fd948ff045b56ad9095d22b39e (patch) | |
tree | cf5d0f0ce017ed4c29c2c46da0cb6311c88c2733 /scripts/utils.py | |
parent | 9f07dd89b7cd2de6ce341afd1aed3e6bd0122a27 (diff) | |
download | linux-conf-perf-ef85245f159402fd948ff045b56ad9095d22b39e.tar.gz linux-conf-perf-ef85245f159402fd948ff045b56ad9095d22b39e.tar.bz2 linux-conf-perf-ef85245f159402fd948ff045b56ad9095d22b39e.zip |
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.
Diffstat (limited to 'scripts/utils.py')
-rw-r--r-- | scripts/utils.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/utils.py b/scripts/utils.py new file mode 100644 index 0000000..55ccb50 --- /dev/null +++ b/scripts/utils.py @@ -0,0 +1,29 @@ +import os +import sys +from conf import conf +from exceptions import MissingFile + +def build_symbol_map(): + """Generates global variable smap from symbol_map_file. + When file not exists, MissingFile exception is raised. + """ + global smap + try: + smap + except NameError: + # Check if symbol_map_file exist + if not os.path.isfile(conf.symbol_map_file): + raise MissingFile(conf.symbol_map_file, "Run kconfig_parser to generate it.") + + smap = dict() + with open(conf.symbol_map_file) as f: + for lnn in f: + w = lnn.rstrip().split(sep=':') + smap[w[0]] = w[1] + +def get_kernel_env(): + env = dict(os.environ) + env['SRCARCH'] = conf.SRCARCH + env['ARCH'] = conf.ARCH + env['KERNELVERSION'] = 'KERNELVERSION' # hides error + return env |