From 2f17da1bf08168a21b97587b52755f84e04a3e90 Mon Sep 17 00:00:00 2001 From: Aradhya Date: Sat, 26 Mar 2022 00:06:17 +0530 Subject: [PATCH] fix: support for local and remote apps when looking for dependencies --- bench/app.py | 4 +--- bench/utils/app.py | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bench/app.py b/bench/app.py index 790850b9..b14c6d82 100755 --- a/bench/app.py +++ b/bench/app.py @@ -220,7 +220,7 @@ class App(AppMeta): if self.on_disk: required_deps = os.path.join(self.mount_path, self.repo,'hooks.py') try: - print(required_apps_from_hooks(required_deps)) + print(required_apps_from_hooks(required_deps, local=True)) except IndexError: print(f"No dependencies for {self.repo}") finally: @@ -231,8 +231,6 @@ class App(AppMeta): except Exception: return [] - return required_apps - def update_app_state(self): from bench.bench import Bench bench = Bench(self.bench.name) diff --git a/bench/utils/app.py b/bench/utils/app.py index f04b0020..32e958f3 100644 --- a/bench/utils/app.py +++ b/bench/utils/app.py @@ -183,9 +183,10 @@ def get_required_deps(org, name, branch, deps="hooks.py"): return base64.decodebytes(res["content"].encode()).decode() -def required_apps_from_hooks(required_deps): - with open(required_deps) as f: - required_deps = f.read() +def required_apps_from_hooks(required_deps, local=False): + if local: + with open(required_deps) as f: + required_deps = f.read() lines = [x for x in required_deps.split("\n") if x.strip().startswith("required_apps")] required_apps = eval(lines[0].strip("required_apps").strip().lstrip("=").strip()) return required_apps