app_caches: use get_apps_repo
This commit is contained in:
parent
a1b9ade4f1
commit
7b0e26fc5b
1 changed files with 8 additions and 9 deletions
|
@ -13,11 +13,8 @@ import tqdm
|
||||||
from git import Repo
|
from git import Repo
|
||||||
from git.repo.fun import is_git_dir
|
from git.repo.fun import is_git_dir
|
||||||
|
|
||||||
from appslib.utils import (
|
from appslib.utils import get_catalog
|
||||||
REPO_APPS_ROOT, # pylint: disable=import-error
|
import appslib.get_apps_repo as get_apps_repo
|
||||||
get_catalog,
|
|
||||||
git_repo_age,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class AppDir:
|
class AppDir:
|
||||||
|
@ -118,6 +115,7 @@ def apps_cache_cleanup(cache_path: Path, apps: dict[str, dict[str, Any]]) -> Non
|
||||||
|
|
||||||
def __run_for_catalog():
|
def __run_for_catalog():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
get_apps_repo.add_args(parser)
|
||||||
parser.add_argument("-v", "--verbose", action="store_true")
|
parser.add_argument("-v", "--verbose", action="store_true")
|
||||||
parser.add_argument("-j", "--processes", type=int, default=8)
|
parser.add_argument("-j", "--processes", type=int, default=8)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -135,20 +133,21 @@ def __run_for_catalog():
|
||||||
help="Download all branches from repo",
|
help="Download all branches from repo",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c",
|
"-d",
|
||||||
"--cleanup",
|
"--delete-missing",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
help="Remove unknown directories from the app cache",
|
help="Remove unknown directories from the app cache",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
logging.getLogger().setLevel(logging.INFO)
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
|
|
||||||
cache_path = REPO_APPS_ROOT / ".apps_cache"
|
cache_path = get_apps_repo.cache_path(args)
|
||||||
cache_path.mkdir(exist_ok=True, parents=True)
|
cache_path.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
if args.cleanup:
|
if args.delete_missing:
|
||||||
apps_cache_cleanup(cache_path, get_catalog())
|
apps_cache_cleanup(cache_path, get_catalog())
|
||||||
|
|
||||||
apps_cache_update_all(
|
apps_cache_update_all(
|
||||||
|
|
Loading…
Reference in a new issue