Improve clean method
This commit is contained in:
parent
03d660df25
commit
232d6ac256
@ -89,17 +89,16 @@ def pdflatex(latex_file, 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 """
|
||||
cleanning = subprocess.Popen(
|
||||
[f"rm {dirname}/*.aux {dirname}/*.log"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
shell=True
|
||||
)
|
||||
out, err = cleanning.communicate()
|
||||
logger.error(err)
|
||||
logger.info(out)
|
||||
if not dirname:
|
||||
dirname = Path("./")
|
||||
for g in garbages:
|
||||
g_files = Path(dirname).files(g)
|
||||
logger.debug(f"Remove {g_files}")
|
||||
print(g_files)
|
||||
for g_file in g_files:
|
||||
g_file.remove()
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
|
Loading…
Reference in New Issue
Block a user