2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-13 16:56:33 +00:00

fix: fixed app states and checking/updating frappe version on install

fix: fixed valid branch check in init
This commit is contained in:
Aradhya 2022-02-07 10:13:15 +05:30
parent e3bd34c12c
commit 42f4d74beb
3 changed files with 12 additions and 12 deletions

View File

@ -352,11 +352,13 @@ def get_app(
repo_name = app.repo
branch = app.tag
bench_setup = False
apps_to_install = make_resolution_plan(app, bench)
frappe_path, frappe_branch = None, None
if resolve:
resolution = make_resolution_plan(app, bench)
frappe_path, frappe_branch = resolution["frappe"].url, resolution["frappe"].tag
if "frappe" in resolution:
# Todo: Make frappe a terminal dependency for all frappe apps.
frappe_path, frappe_branch = resolution["frappe"].url, resolution["frappe"].tag
if not is_bench_directory(bench_path):
if not init_bench:
@ -367,12 +369,11 @@ def get_app(
from bench.utils.system import init
frappe_app = apps_to_install["frappe"]
bench_path = get_available_folder_name(f"{app.repo}-bench", bench_path)
init(
path=bench_path,
frappe_path=frappe_path if resolve else None,
frappe_branch=frappe_branch if resolve else branch,
frappe_path=frappe_path,
frappe_branch=frappe_branch if frappe_branch else branch,
)
os.chdir(bench_path)
bench_setup = True

View File

@ -152,7 +152,6 @@ class BenchApps(MutableSequence):
def __init__(self, bench: Bench):
self.bench = bench
self.initialize_apps()
self.initialize_states()
def initialize_states(self):
try:
@ -163,9 +162,7 @@ class BenchApps(MutableSequence):
self.states = json.loads(f.read() or "{}")
def update_apps_states(self, app_name: str = None, resolution: str = None):
# Only tracking for app state for apps installed via `bench resolve-and-install`,
# Not all states can be maintained as some apps may not be install via bench resolve-and-install
# or may not be compatible with versioning
self.initialize_states()
self.initialize_apps()
apps_to_remove = []
for app in self.states:

View File

@ -50,9 +50,11 @@ def is_frappe_app(directory: str) -> bool:
def is_valid_frappe_branch(frappe_path: str, frappe_branch: str):
url = frappe_path
url += "/tree/" + frappe_branch if frappe_branch else ""
return requests.get(url).status_code != 404
if "http" in frappe_path:
url = frappe_path
url += "/tree/" + frappe_branch if frappe_branch else ""
return requests.get(url).status_code != 404
return True
def log(message, level=0, no_log=False):