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