Skip to content

Commit

Permalink
fix: file-uri while app initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aradhya-Tripathi committed Feb 23, 2022
1 parent 28e6816 commit 2fed369
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
import typing
from datetime import date
from urllib.parse import urlparse

# imports - third party imports
import click
Expand Down Expand Up @@ -62,6 +63,9 @@ class Healthcare(AppConfig):
self.from_apps = False
self.is_url = False
self.branch = branch
self.mount_path = os.path.abspath(
os.path.join(urlparse(self.name).netloc, urlparse(self.name).path)
)
self.setup_details()

def setup_details(self):
Expand All @@ -75,7 +79,7 @@ def setup_details(self):
self._setup_details_from_installed_apps()

# fetch meta for repo on mounted disk
elif os.path.exists(self.name):
elif os.path.exists(self.mount_path):
self.on_disk = True
self._setup_details_from_mounted_disk()

Expand All @@ -91,7 +95,9 @@ def setup_details(self):
self._setup_details_from_name_tag()

def _setup_details_from_mounted_disk(self):
self.org, self.repo, self.tag = os.path.split(self.name)[-2:] + (self.branch,)
self.org, self.repo, self.tag = os.path.split(self.mount_path)[-2:] + (
self.branch,
)

def _setup_details_from_name_tag(self):
self.org, self.repo, self.tag = fetch_details_from_tag(self.name)
Expand Down Expand Up @@ -122,7 +128,7 @@ def url(self):
return os.path.abspath(os.path.join("apps", self.name))

if self.on_disk:
return os.path.abspath(self.name)
return self.mount_path

if self.is_url:
return self.name
Expand Down

0 comments on commit 2fed369

Please sign in to comment.