mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
fix: fixed init in get-app and frappe versions
This commit is contained in:
parent
2363fe38d5
commit
e3bd34c12c
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"python.formatting.provider": "black"
|
||||
}
|
22
bench/app.py
22
bench/app.py
@ -354,6 +354,10 @@ def get_app(
|
||||
bench_setup = False
|
||||
apps_to_install = make_resolution_plan(app, bench)
|
||||
|
||||
if resolve:
|
||||
resolution = make_resolution_plan(app, bench)
|
||||
frappe_path, frappe_branch = resolution["frappe"].url, resolution["frappe"].tag
|
||||
|
||||
if not is_bench_directory(bench_path):
|
||||
if not init_bench:
|
||||
raise NotInBenchDirectoryError(
|
||||
@ -365,7 +369,11 @@ def get_app(
|
||||
|
||||
frappe_app = apps_to_install["frappe"]
|
||||
bench_path = get_available_folder_name(f"{app.repo}-bench", bench_path)
|
||||
init(path=bench_path, frappe_branch=frappe_app.tag)
|
||||
init(
|
||||
path=bench_path,
|
||||
frappe_path=frappe_path if resolve else None,
|
||||
frappe_branch=frappe_branch if resolve else branch,
|
||||
)
|
||||
os.chdir(bench_path)
|
||||
bench_setup = True
|
||||
|
||||
@ -378,9 +386,8 @@ def get_app(
|
||||
})
|
||||
|
||||
if resolve:
|
||||
resolve_and_install(
|
||||
app=app,
|
||||
bench=bench,
|
||||
install_resolved_deps(
|
||||
resolution,
|
||||
bench_path=bench_path,
|
||||
skip_assets=skip_assets,
|
||||
verbose=verbose,
|
||||
@ -412,17 +419,14 @@ def get_app(
|
||||
):
|
||||
app.install(verbose=verbose, skip_assets=skip_assets)
|
||||
|
||||
def resolve_and_install(
|
||||
app: App,
|
||||
bench: "Bench",
|
||||
def install_resolved_deps(
|
||||
resolution,
|
||||
bench_path=".",
|
||||
skip_assets=False,
|
||||
verbose=False,
|
||||
):
|
||||
from bench.utils.app import check_existing_dir
|
||||
|
||||
|
||||
resolution = make_resolution_plan(app, bench)
|
||||
if "frappe" in resolution:
|
||||
# Terminal dependency
|
||||
del resolution["frappe"]
|
||||
|
@ -11,6 +11,7 @@ from typing import List, Tuple
|
||||
|
||||
# imports - third party imports
|
||||
import click
|
||||
import requests
|
||||
|
||||
# imports - module imports
|
||||
from bench import PROJECT_NAME, VERSION
|
||||
@ -48,6 +49,12 @@ def is_frappe_app(directory: str) -> bool:
|
||||
return bool(is_frappe_app)
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
def log(message, level=0, no_log=False):
|
||||
import bench
|
||||
import bench.cli
|
||||
|
@ -14,6 +14,7 @@ from bench.utils import (
|
||||
run_frappe_cmd,
|
||||
sudoers_file,
|
||||
which,
|
||||
is_valid_frappe_branch,
|
||||
)
|
||||
from bench.utils.bench import build_assets, clone_apps_from
|
||||
from bench.utils.render import job
|
||||
@ -74,7 +75,11 @@ def init(
|
||||
# remote apps
|
||||
else:
|
||||
frappe_path = frappe_path or "https://github.com/frappe/frappe.git"
|
||||
|
||||
frappe_branch = (
|
||||
frappe_branch
|
||||
if is_valid_frappe_branch(frappe_path, frappe_branch)
|
||||
else None
|
||||
)
|
||||
get_app(
|
||||
frappe_path,
|
||||
branch=frappe_branch,
|
||||
|
Loading…
Reference in New Issue
Block a user