mirror of
https://github.com/frappe/bench.git
synced 2024-11-11 07:41:03 +00:00
chore: update secho messages
This commit is contained in:
parent
16f89067c6
commit
8854551eee
11
bench/app.py
11
bench/app.py
@ -385,13 +385,13 @@ class App(AppMeta):
|
|||||||
if app_path.is_dir():
|
if app_path.is_dir():
|
||||||
shutil.rmtree(app_path)
|
shutil.rmtree(app_path)
|
||||||
|
|
||||||
click.secho(f"Getting {self.app_name} from cache", fg="yellow")
|
click.secho(f"Bench app-cache: getting {self.app_name} from cache", fg="yellow")
|
||||||
with tarfile.open(cache_path, mode) as tar:
|
with tarfile.open(cache_path, mode) as tar:
|
||||||
extraction_filter = get_app_cache_extract_filter(count_threshold=150_000)
|
extraction_filter = get_app_cache_extract_filter(count_threshold=150_000)
|
||||||
try:
|
try:
|
||||||
tar.extractall(app_path.parent, filter=extraction_filter)
|
tar.extractall(app_path.parent, filter=extraction_filter)
|
||||||
except Exception:
|
except Exception:
|
||||||
message = f"Cache extraction failed for {self.app_name}, skipping cache"
|
message = f"Bench app-cache: extraction failed for {self.app_name}, skipping cache"
|
||||||
click.secho(message, fg="yellow")
|
click.secho(message, fg="yellow")
|
||||||
logger.exception(message)
|
logger.exception(message)
|
||||||
shutil.rmtree(app_path)
|
shutil.rmtree(app_path)
|
||||||
@ -411,7 +411,7 @@ class App(AppMeta):
|
|||||||
cache_path = self.get_app_cache_temp_path(compress_artifacts)
|
cache_path = self.get_app_cache_temp_path(compress_artifacts)
|
||||||
mode = "w:gz" if compress_artifacts else "w"
|
mode = "w:gz" if compress_artifacts else "w"
|
||||||
|
|
||||||
message = f"Caching {self.app_name} app directory"
|
message = f"Bench app-cache: caching {self.app_name} app directory"
|
||||||
if compress_artifacts:
|
if compress_artifacts:
|
||||||
message += " (compressed)"
|
message += " (compressed)"
|
||||||
click.secho(message)
|
click.secho(message)
|
||||||
@ -428,7 +428,7 @@ class App(AppMeta):
|
|||||||
|
|
||||||
success = True
|
success = True
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
log(f"Failed to cache {app_path} {exc}", level=3)
|
log(f"Bench app-cache: failed to cache {app_path} {exc}", level=3)
|
||||||
success = False
|
success = False
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
@ -501,7 +501,7 @@ def can_frappe_use_cached(app: App) -> bool:
|
|||||||
"""
|
"""
|
||||||
return sv.Version("15.12.0") not in sv.SimpleSpec(min_frappe)
|
return sv.Version("15.12.0") not in sv.SimpleSpec(min_frappe)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
click.secho(f"Invalid value found for frappe version '{min_frappe}'", fg="yellow")
|
click.secho(f"Bench app-cache: invalid value found for frappe version '{min_frappe}'", fg="yellow")
|
||||||
# Invalid expression
|
# Invalid expression
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -610,6 +610,7 @@ def remove_unused_node_modules(app_path: Path) -> None:
|
|||||||
can_delete = "vite build" in build_script
|
can_delete = "vite build" in build_script
|
||||||
|
|
||||||
if can_delete:
|
if can_delete:
|
||||||
|
click.secho(f"Bench app-cache: removing {node_modules.as_posix()}")
|
||||||
shutil.rmtree(node_modules)
|
shutil.rmtree(node_modules)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user