mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
projects.py: Ongoing code beautification
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
fbf75b1220
commit
430a2173b2
1 changed files with 13 additions and 15 deletions
|
|
@ -87,6 +87,18 @@ class Projects(object):
|
||||||
def err(self, *objs):
|
def err(self, *objs):
|
||||||
print("ERR: ", *objs, file = sys.stderr)
|
print("ERR: ", *objs, file = sys.stderr)
|
||||||
|
|
||||||
|
def find_proj_path_unused(name):
|
||||||
|
name = name.replace("dspider-", "")
|
||||||
|
search_path = [".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
||||||
|
for sub in search_path:
|
||||||
|
path = self.projs_root + "/" + sub + "/" + name
|
||||||
|
if os.path.exists(path):
|
||||||
|
return os.path.abspath(path)
|
||||||
|
raise Exception("module " + name + " not found below " + self.projs_root)
|
||||||
|
|
||||||
|
def find_proj_path_cached_unused(name):
|
||||||
|
return self.res_cache.run(find_proj_path_unused, [ name ])
|
||||||
|
|
||||||
def proj_dir(self, name):
|
def proj_dir(self, name):
|
||||||
if name == self.top_name:
|
if name == self.top_name:
|
||||||
return self.topdir
|
return self.topdir
|
||||||
|
|
@ -451,18 +463,6 @@ class Projects(object):
|
||||||
|
|
||||||
def cmd_build(self, args_):
|
def cmd_build(self, args_):
|
||||||
|
|
||||||
def find_proj_path(name):
|
|
||||||
name = name.replace("dspider-", "")
|
|
||||||
search_path = [".", "dspc/src", "dspc/src/dspcd-plugins", "dspc/src/io" ]
|
|
||||||
for sub in search_path:
|
|
||||||
path = self.projs_root + "/" + sub + "/" + name
|
|
||||||
if os.path.exists(path):
|
|
||||||
return os.path.abspath(path)
|
|
||||||
raise Exception("module " + name + " not found below " + self.projs_root)
|
|
||||||
|
|
||||||
def find_proj_path_cached(name):
|
|
||||||
return self.res_cache.run(find_proj_path, [ name ])
|
|
||||||
|
|
||||||
def read_deps(cur, prereq_type):
|
def read_deps(cur, prereq_type):
|
||||||
# dep cache doesn't make a difference at all
|
# dep cache doesn't make a difference at all
|
||||||
if prereq_type in self.dep_cache:
|
if prereq_type in self.dep_cache:
|
||||||
|
|
@ -474,7 +474,6 @@ class Projects(object):
|
||||||
r = self.get_modules_from_project_txt([ cur ], ['pkg.requires.jw'],
|
r = self.get_modules_from_project_txt([ cur ], ['pkg.requires.jw'],
|
||||||
prereq_type, scope = 2, add_self=False, names_only=True)
|
prereq_type, scope = 2, add_self=False, names_only=True)
|
||||||
self.debug('prerequisites = ' + ' '.join(r))
|
self.debug('prerequisites = ' + ' '.join(r))
|
||||||
|
|
||||||
if cur in r:
|
if cur in r:
|
||||||
r.remove(cur)
|
r.remove(cur)
|
||||||
self.debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
self.debug('inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r))
|
||||||
|
|
@ -489,7 +488,6 @@ class Projects(object):
|
||||||
if cur in all_deps:
|
if cur in all_deps:
|
||||||
self.debug('already handled module ' + cur)
|
self.debug('already handled module ' + cur)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
deps = set()
|
deps = set()
|
||||||
all_deps.add(cur)
|
all_deps.add(cur)
|
||||||
for t in prereq_types:
|
for t in prereq_types:
|
||||||
|
|
@ -523,7 +521,7 @@ class Projects(object):
|
||||||
def run_make(module, target, cur_project, num_projects):
|
def run_make(module, target, cur_project, num_projects):
|
||||||
#make_cmd = "make " + target + " 2>&1"
|
#make_cmd = "make " + target + " 2>&1"
|
||||||
make_cmd = [ "make", target ]
|
make_cmd = [ "make", target ]
|
||||||
path = find_proj_path_cached(module)
|
path = self.proj_dir(module)
|
||||||
delim_len = 120
|
delim_len = 120
|
||||||
delim = '---- [%d/%d]: running %s in %s -' % (cur_project, num_projects, make_cmd, path)
|
delim = '---- [%d/%d]: running %s in %s -' % (cur_project, num_projects, make_cmd, path)
|
||||||
delim = delim + '-' * (delim_len - len(delim))
|
delim = delim + '-' * (delim_len - len(delim))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue