mirror of
https://github.com/frappe/bench.git
synced 2025-01-25 07:58:24 +00:00
feat: Added support for mounted app in get_dependencies
This commit is contained in:
parent
8230ba6096
commit
0b862c0745
13
bench/app.py
13
bench/app.py
@ -215,12 +215,19 @@ class App(AppMeta):
|
|||||||
self.bench.run(f"{self.bench.python} -m pip uninstall -y {self.repo}")
|
self.bench.run(f"{self.bench.python} -m pip uninstall -y {self.repo}")
|
||||||
|
|
||||||
def _get_dependencies(self):
|
def _get_dependencies(self):
|
||||||
from bench.utils.app import get_required_deps
|
from bench.utils.app import get_required_deps, required_apps_from_hooks
|
||||||
|
|
||||||
|
if self.on_disk:
|
||||||
|
required_deps = os.path.join(self.mount_path, self.repo,'hooks.py')
|
||||||
|
try:
|
||||||
|
print(required_apps_from_hooks(required_deps))
|
||||||
|
except IndexError:
|
||||||
|
print(f"No dependencies for {self.repo}")
|
||||||
|
finally:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
required_deps = get_required_deps(self.org, self.repo, self.tag or self.branch)
|
required_deps = get_required_deps(self.org, self.repo, self.tag or self.branch)
|
||||||
lines = [x for x in required_deps.split("\n") if x.strip().startswith("required_apps")]
|
return required_apps_from_hooks(required_deps)
|
||||||
required_apps = eval(lines[0].strip("required_apps").strip().lstrip("=").strip())
|
|
||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -183,6 +183,14 @@ 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):
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
def get_remote(app, bench_path="."):
|
def get_remote(app, bench_path="."):
|
||||||
repo_dir = get_repo_dir(app, bench_path=bench_path)
|
repo_dir = get_repo_dir(app, bench_path=bench_path)
|
||||||
contents = subprocess.check_output(
|
contents = subprocess.check_output(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user