Change path Path

This commit is contained in:
Benjamin Bertrand 2017-04-04 13:34:49 +03:00
parent 46397e0bc7
commit 28daa4eedb

View File

@ -5,7 +5,7 @@ import os
import sys import sys
import optparse import optparse
import csv import csv
from path import path from path import Path
from .texenv import texenv from .texenv import texenv
@ -42,11 +42,11 @@ def produce_and_compile(options):
template = texenv.get_template(options.template) template = texenv.get_template(options.template)
# Saving place # Saving place
cwd = path("./").abspath() cwd = Path("./").abspath()
template_file = path(options.template) template_file = Path(options.template)
output = path(template_file.dirname()) / path(template_file.name[3:]) output = Path(template_file.dirname()) / Path(template_file.name[3:])
if not options.csv_file: if not options.csv_file:
# {:02:0f} means that we want a 2 digits number # {:02:0f} means that we want a 2 digits number
@ -68,7 +68,7 @@ def produce_and_compile(options):
tmp_pdf = [] tmp_pdf = []
for infos in list_infos: for infos in list_infos:
#print("_______" + str(infos)) #print("_______" + str(infos))
dest = path(str(infos['num']) + output) dest = Path(str(infos['num']) + output)
tmp_pdf.append(dest.namebase + ".pdf") tmp_pdf.append(dest.namebase + ".pdf")
with open( dest, 'w') as f: with open( dest, 'w') as f:
f.write(template.render( infos = infos, **export_dict )) f.write(template.render( infos = infos, **export_dict ))
@ -80,10 +80,10 @@ def produce_and_compile(options):
os.system("rm *.aux *.log") os.system("rm *.aux *.log")
if not options.no_join: if not options.no_join:
print(path("./").abspath()) print(Path("./").abspath())
print("pdfjam "+ " ".join(tmp_pdf) + " -o all" + path(output).namebase + ".pdf") print("pdfjam "+ " ".join(tmp_pdf) + " -o all" + Path(output).namebase + ".pdf")
os.system("pdfjam "+ " ".join(tmp_pdf) + " -o all" + path(output).namebase + ".pdf") os.system("pdfjam "+ " ".join(tmp_pdf) + " -o all" + Path(output).namebase + ".pdf")
#os.system("pdfjam *.pdf -o all" + path(output).namebase + ".pdf") #os.system("pdfjam *.pdf -o all" + Path(output).namebase + ".pdf")
print("rm " + " ".join(tmp_pdf)) print("rm " + " ".join(tmp_pdf))
os.system("rm " + " ".join(tmp_pdf)) os.system("rm " + " ".join(tmp_pdf))
@ -99,10 +99,10 @@ def produce_and_compile(options):
os.system("rm *.aux *.log") os.system("rm *.aux *.log")
if not options.no_join: if not options.no_join:
print(path("./").abspath()) print(Path("./").abspath())
print("pdfjam `find ./ -iname '[0-9]*.pdf'` -o corr" + path(output).namebase + ".pdf") print("pdfjam `find ./ -iname '[0-9]*.pdf'` -o corr" + Path(output).namebase + ".pdf")
os.system("pdfjam `find ./ -iname '[0-9]*.pdf'` -o corr" + path(output).namebase + ".pdf") os.system("pdfjam `find ./ -iname '[0-9]*.pdf'` -o corr" + Path(output).namebase + ".pdf")
#os.system("pdfjam *.pdf -o all" + path(output).namebase + ".pdf") #os.system("pdfjam *.pdf -o all" + Path(output).namebase + ".pdf")
print("find ./ -iname '[0-9]*.pdf' -exec rm -f {} \;") print("find ./ -iname '[0-9]*.pdf' -exec rm -f {} \;")
os.system("find ./ -iname '[0-9]*.pdf' -exec rm -f {} \;") os.system("find ./ -iname '[0-9]*.pdf' -exec rm -f {} \;")