mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 13:38:12 +02:00
made a better clean of the output
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import argparse, os, sys, subprocess, docker
|
import argparse, os, sys, subprocess, docker, re
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
@ -137,10 +137,20 @@ def remove_dir(dir: str) -> None:
|
|||||||
shutil.rmtree(parent)
|
shutil.rmtree(parent)
|
||||||
|
|
||||||
def clean_output(output: bytes) -> str:
|
def clean_output(output: bytes) -> str:
|
||||||
output_str = output.decode()
|
output_lines = output.decode().split("\n")
|
||||||
def _keep(line):
|
cleaned_lines = []
|
||||||
return not (line.startswith("Download") or line.startswith("Progress"))
|
downloading_block = False
|
||||||
return "\n".join([line for line in output_str.split("\n") if _keep(line)])
|
|
||||||
|
for line in output_lines:
|
||||||
|
if re.match(r"\[INFO\] Download(ing|ed) from", line):
|
||||||
|
if not downloading_block:
|
||||||
|
cleaned_lines.append("[CRAB] Downloading stuff")
|
||||||
|
downloading_block = True
|
||||||
|
else:
|
||||||
|
cleaned_lines.append(line)
|
||||||
|
downloading_block = False
|
||||||
|
|
||||||
|
return "\n".join(cleaned_lines)
|
||||||
|
|
||||||
def compile_repo(build_file: str, container, updates: dict) -> bool:
|
def compile_repo(build_file: str, container, updates: dict) -> bool:
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user