mirror of
https://github.com/frappe/bench.git
synced 2024-11-14 17:24:04 +00:00
refactor: use env to trigger using-cached flag
Click supports pulling args from an envvar if it is present, this would be quicker and cleaner than calling a dummy command to check if the feature is supported
This commit is contained in:
parent
d177d8ff63
commit
683a421e43
@ -354,17 +354,11 @@ def build_assets(bench_path=".", app=None, using_cached=False):
|
|||||||
if app:
|
if app:
|
||||||
command += f" --app {app}"
|
command += f" --app {app}"
|
||||||
|
|
||||||
if using_cached and can_use_cached(bench_path):
|
env = {"BENCH_DEVELOPER": "1"}
|
||||||
command += " --using-cached"
|
if using_cached:
|
||||||
|
env["USING_CACHED"] = "1"
|
||||||
|
|
||||||
exec_cmd(command, cwd=bench_path, env={"BENCH_DEVELOPER": "1"})
|
exec_cmd(command, cwd=bench_path, env=env)
|
||||||
|
|
||||||
def can_use_cached(bench_path=".") -> bool:
|
|
||||||
cmd = ["bench", "can-use-cached"]
|
|
||||||
return_code = subprocess.call(
|
|
||||||
cmd, cwd=bench_path, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
|
||||||
)
|
|
||||||
return not return_code
|
|
||||||
|
|
||||||
def handle_version_upgrade(version_upgrade, bench_path, force, reset, conf):
|
def handle_version_upgrade(version_upgrade, bench_path, force, reset, conf):
|
||||||
from bench.utils import log, pause_exec
|
from bench.utils import log, pause_exec
|
||||||
|
Loading…
Reference in New Issue
Block a user