2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 17:24:41 +00:00

fix: support for local and remote apps when looking for dependencies

This commit is contained in:
Aradhya 2022-03-26 00:06:17 +05:30
parent 61a864de11
commit 2f17da1bf0
2 changed files with 5 additions and 6 deletions

View File

@ -220,7 +220,7 @@ class App(AppMeta):
if self.on_disk: if self.on_disk:
required_deps = os.path.join(self.mount_path, self.repo,'hooks.py') required_deps = os.path.join(self.mount_path, self.repo,'hooks.py')
try: try:
print(required_apps_from_hooks(required_deps)) print(required_apps_from_hooks(required_deps, local=True))
except IndexError: except IndexError:
print(f"No dependencies for {self.repo}") print(f"No dependencies for {self.repo}")
finally: finally:
@ -231,8 +231,6 @@ class App(AppMeta):
except Exception: except Exception:
return [] return []
return required_apps
def update_app_state(self): def update_app_state(self):
from bench.bench import Bench from bench.bench import Bench
bench = Bench(self.bench.name) bench = Bench(self.bench.name)

View File

@ -183,9 +183,10 @@ def get_required_deps(org, name, branch, deps="hooks.py"):
return base64.decodebytes(res["content"].encode()).decode() return base64.decodebytes(res["content"].encode()).decode()
def required_apps_from_hooks(required_deps): def required_apps_from_hooks(required_deps, local=False):
with open(required_deps) as f: if local:
required_deps = f.read() 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")] 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()) required_apps = eval(lines[0].strip("required_apps").strip().lstrip("=").strip())
return required_apps return required_apps