mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
CmdBuild: Don't use App.res_cache()
App.res_cache should be private. It's needed here to cache the results of a function which is private to CmdBuild anyway, so solve that with lru_cache, to allow App to do it's private thing with caching. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
eafed6434b
commit
917f56a814
1 changed files with 3 additions and 4 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os, re, sys, subprocess, datetime, time
|
||||
from argparse import Namespace, ArgumentParser
|
||||
from functools import lru_cache
|
||||
|
||||
from ...lib.log import *
|
||||
from ..Cmd import Cmd
|
||||
|
|
@ -25,6 +26,7 @@ class CmdBuild(Cmd): # export
|
|||
|
||||
def _run(self, args: Namespace) -> None:
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
def read_deps(cur, prereq_type):
|
||||
# dep cache doesn't make a difference at all
|
||||
if prereq_type in dep_cache:
|
||||
|
|
@ -42,9 +44,6 @@ class CmdBuild(Cmd): # export
|
|||
dep_cache[prereq_type][cur] = ret
|
||||
return ret
|
||||
|
||||
def read_deps_cached(cur, prereq_type):
|
||||
return self.app.res_cache.run(read_deps, [ cur, prereq_type ])
|
||||
|
||||
def add_dep_tree(cur, prereq_types, tree, all_deps):
|
||||
log(DEBUG, "adding prerequisites " + ' '.join(prereq_types) + " of module " + cur)
|
||||
if cur in all_deps:
|
||||
|
|
@ -54,7 +53,7 @@ class CmdBuild(Cmd): # export
|
|||
all_deps.add(cur)
|
||||
for t in prereq_types:
|
||||
log(DEBUG, "checking prereqisites of type " + t)
|
||||
deps.update(read_deps_cached(cur, t))
|
||||
deps.update(read_deps(cur, t))
|
||||
for d in deps:
|
||||
add_dep_tree(d, prereq_types, tree, all_deps)
|
||||
tree[cur] = deps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue