Skip to content

Commit

Permalink
fix: support for local and remote apps when looking for dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Aradhya-Tripathi committed Mar 25, 2022
1 parent 61a864d commit 2f17da1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _get_dependencies(self):
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:
Expand All @@ -231,8 +231,6 @@ def _get_dependencies(self):
except Exception:
return []

return required_apps

def update_app_state(self):
from bench.bench import Bench
bench = Bench(self.bench.name)
Expand Down
7 changes: 4 additions & 3 deletions bench/utils/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f17da1

Please sign in to comment.