build.py, projects.py: Streamline both scripts

Make build.py and projects.py even more similar in preparation for
merging them.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2018-03-07 10:17:14 +00:00
commit f7db567bff
2 changed files with 45 additions and 38 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/python2 -u
from __future__ import print_function
import os
import sys
import argparse
from sets import Set
@ -100,7 +101,7 @@ def htdocs_dir(name):
def os_cascade():
r = [ 'os', platform.system().lower() ]
os = cache.run(get_os, [])
os = res_cache.run(get_os, [])
name = re.sub('-.*', '', os)
series = os
while True:
@ -190,7 +191,7 @@ def get_value(name, section, key):
path = proj_root + '/make/project.conf'
#print('path = ', path, 'top_name = ', top_name, 'name = ', name)
return cache.run(read_value, [path, section, key])
return res_cache.run(read_value, [path, section, key])
def collect_values(names, section, key):
r = ""
@ -206,7 +207,7 @@ def collect_values(names, section, key):
def add_modules_from_project_txt_cached(buf, visited, spec, section, key, add_self, scope,
names_only):
return cache.run(add_modules_from_project_txt, [buf, visited, spec, section, key,
return res_cache.run(add_modules_from_project_txt, [buf, visited, spec, section, key,
add_self, scope, names_only])
def add_modules_from_project_txt(buf, visited, spec, section, key, add_self, scope,
@ -606,7 +607,9 @@ def cmd_getval(args_):
# -------------------------------------------------------------------- here we go
global_args = []
cache = ResultCache()
res_cache = ResultCache()
dep_cache = {}
my_dir = os.path.dirname(os.path.realpath(__file__))
skip = 0
for a in sys.argv[1::]: