mirror of
https://github.com/frappe/bench.git
synced 2025-01-27 08:18:25 +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:
parent
e3bd34c12c
commit
42f4d74beb
11
bench/app.py
11
bench/app.py
@ -352,11 +352,13 @@ def get_app(
|
|||||||
repo_name = app.repo
|
repo_name = app.repo
|
||||||
branch = app.tag
|
branch = app.tag
|
||||||
bench_setup = False
|
bench_setup = False
|
||||||
apps_to_install = make_resolution_plan(app, bench)
|
frappe_path, frappe_branch = None, None
|
||||||
|
|
||||||
if resolve:
|
if resolve:
|
||||||
resolution = make_resolution_plan(app, bench)
|
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 is_bench_directory(bench_path):
|
||||||
if not init_bench:
|
if not init_bench:
|
||||||
@ -367,12 +369,11 @@ def get_app(
|
|||||||
|
|
||||||
from bench.utils.system import init
|
from bench.utils.system import init
|
||||||
|
|
||||||
frappe_app = apps_to_install["frappe"]
|
|
||||||
bench_path = get_available_folder_name(f"{app.repo}-bench", bench_path)
|
bench_path = get_available_folder_name(f"{app.repo}-bench", bench_path)
|
||||||
init(
|
init(
|
||||||
path=bench_path,
|
path=bench_path,
|
||||||
frappe_path=frappe_path if resolve else None,
|
frappe_path=frappe_path,
|
||||||
frappe_branch=frappe_branch if resolve else branch,
|
frappe_branch=frappe_branch if frappe_branch else branch,
|
||||||
)
|
)
|
||||||
os.chdir(bench_path)
|
os.chdir(bench_path)
|
||||||
bench_setup = True
|
bench_setup = True
|
||||||
|
@ -152,7 +152,6 @@ class BenchApps(MutableSequence):
|
|||||||
def __init__(self, bench: Bench):
|
def __init__(self, bench: Bench):
|
||||||
self.bench = bench
|
self.bench = bench
|
||||||
self.initialize_apps()
|
self.initialize_apps()
|
||||||
self.initialize_states()
|
|
||||||
|
|
||||||
def initialize_states(self):
|
def initialize_states(self):
|
||||||
try:
|
try:
|
||||||
@ -163,9 +162,7 @@ class BenchApps(MutableSequence):
|
|||||||
self.states = json.loads(f.read() or "{}")
|
self.states = json.loads(f.read() or "{}")
|
||||||
|
|
||||||
def update_apps_states(self, app_name: str = None, resolution: str = None):
|
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`,
|
self.initialize_states()
|
||||||
# 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_apps()
|
self.initialize_apps()
|
||||||
apps_to_remove = []
|
apps_to_remove = []
|
||||||
for app in self.states:
|
for app in self.states:
|
||||||
|
@ -50,9 +50,11 @@ def is_frappe_app(directory: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def is_valid_frappe_branch(frappe_path: str, frappe_branch: str):
|
def is_valid_frappe_branch(frappe_path: str, frappe_branch: str):
|
||||||
url = frappe_path
|
if "http" in frappe_path:
|
||||||
url += "/tree/" + frappe_branch if frappe_branch else ""
|
url = frappe_path
|
||||||
return requests.get(url).status_code != 404
|
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):
|
def log(message, level=0, no_log=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user