From 2fed369066a71e3631edba8f711e421499427803 Mon Sep 17 00:00:00 2001 From: Aradhya Date: Wed, 23 Feb 2022 14:23:06 +0530 Subject: [PATCH] fix: file-uri while app initialisation --- bench/app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bench/app.py b/bench/app.py index 259b6429..5ce0f8fc 100755 --- a/bench/app.py +++ b/bench/app.py @@ -9,6 +9,7 @@ import subprocess import sys import typing from datetime import date +from urllib.parse import urlparse # imports - third party imports import click @@ -62,6 +63,9 @@ class AppMeta: 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): @@ -75,7 +79,7 @@ class AppMeta: 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() @@ -91,7 +95,9 @@ class AppMeta: 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) @@ -122,7 +128,7 @@ class AppMeta: 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