From 69d16b04587aa9ea23730528fb2759d9886a724c Mon Sep 17 00:00:00 2001 From: cohen Date: Sun, 16 Sep 2007 10:17:38 +0200 Subject: [PATCH] bugfix : on traite le cas ou le .ps n'as jamais t cre darcs-hash:20070916081738-f6463-826b08d06b8bdcd6516c92a9f21394e74f879c3d.gz --- lib/impression/cout.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/impression/cout.py b/lib/impression/cout.py index 10e74671..85176336 100755 --- a/lib/impression/cout.py +++ b/lib/impression/cout.py @@ -87,7 +87,7 @@ def base_prix(path_pdf_file, color=False): nom_rep = tempfile.mkdtemp(prefix='tmpimpr') nom_png = "%s/convert.png" % nom_rep # Nom prefixe et chemin des png créé par convert escaped_path_pdf_file = escapeForShell(path_pdf_file) - escaped_path_ps_file = path_pdf_file + ".ps" + escaped_path_ps_file = escapeForShell(path_pdf_file + ".ps") error_msg = "ERREUR %%d : Fichier invalide. Aucun %s cree." if color: error_msg += " (couleurs)" @@ -99,12 +99,13 @@ def base_prix(path_pdf_file, color=False): nb_composante = 1 # Noir percent_program = "percentblack" - if os.stat(path_pdf_file)[stat.ST_MTIME] > os.stat(path_pdf_file + ".ps")[stat.ST_MTIME]: - # Convertit les pdf en ps - try_command("nice -n 5 pdftops %s %s" % (escaped_path_pdf_file, - escaped_path_ps_file), - nom_rep, - error_msg % "ps") + if not os.access(path_pdf_file + ".ps",os.F_OK) or \ + os.stat(path_pdf_file)[stat.ST_MTIME] > os.stat(path_pdf_file + ".ps")[stat.ST_MTIME]: + # Convertit les pdf en ps + try_command("nice -n 5 pdftops %s %s" % (escaped_path_pdf_file, + escaped_path_ps_file), + nom_rep, + error_msg % "ps") # Convertit les ps en png (il est néscessaire de passer par un ps # car ghostscript refuse certain pdf)