CmdBuild: Don't use App.dep_cache

App.dep_cache is only used by CmdBuild, prepare for removing it from
App.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-26 11:56:25 +01:00
commit eafed6434b

View file

@ -27,20 +27,20 @@ class CmdBuild(Cmd): # export
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.app.dep_cache: if prereq_type in dep_cache:
if cur in self.app.dep_cache[prereq_type]: if cur in dep_cache[prereq_type]:
return self.app.dep_cache[prereq_type][cur] return dep_cache[prereq_type][cur]
else: else:
self.app.dep_cache[prereq_type] = {} dep_cache[prereq_type]: dict[str, str] = {}
r = self.app.get_modules_from_project_txt([ cur ], ['pkg.requires.jw'], ret = self.app.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)
log(DEBUG, 'prerequisites = ' + ' '.join(r)) log(DEBUG, 'prerequisites = ' + ' '.join(ret))
if cur in r: if cur in ret:
r.remove(cur) ret.remove(cur)
log(DEBUG, 'inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(r)) log(DEBUG, 'inserting', prereq_type, "prerequisites of", cur, ":", ' '.join(ret))
self.app.dep_cache[prereq_type][cur] = r dep_cache[prereq_type][cur] = ret
return r return ret
def read_deps_cached(cur, prereq_type): def read_deps_cached(cur, prereq_type):
return self.app.res_cache.run(read_deps, [ cur, prereq_type ]) return self.app.res_cache.run(read_deps, [ cur, prereq_type ])
@ -172,4 +172,6 @@ class CmdBuild(Cmd): # export
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
dep_cache: dict[dict[str, str]] = {}
run(args) run(args)