Improve clean method

This commit is contained in:
Benjamin Bertrand 2017-04-17 08:26:32 +03:00
parent 03d660df25
commit 232d6ac256
1 changed files with 9 additions and 10 deletions

View File

@ -89,17 +89,16 @@ def pdflatex(latex_file, output_dir=""):
logger.debug(f"{latex_file} has been compiled in {output_dir}") logger.debug(f"{latex_file} has been compiled in {output_dir}")
def clean(dirname="."): def clean(dirname=".", garbages=["*.aux", "*.log"]):
""" Clean the directory from aux and log latex files """ """ Clean the directory from aux and log latex files """
cleanning = subprocess.Popen( if not dirname:
[f"rm {dirname}/*.aux {dirname}/*.log"], dirname = Path("./")
stdout=subprocess.PIPE, for g in garbages:
stderr=subprocess.PIPE, g_files = Path(dirname).files(g)
shell=True logger.debug(f"Remove {g_files}")
) print(g_files)
out, err = cleanning.communicate() for g_file in g_files:
logger.error(err) g_file.remove()
logger.info(out)
# ----------------------------- # -----------------------------
# Reglages pour 'vim' # Reglages pour 'vim'