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}")
|
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'
|
||||||
|
Loading…
Reference in New Issue
Block a user