Final patch ready to push.

http://code.google.com/p/lilypond/issues/detail?id=2105
From cc8e92ac950f03e052d5c1e07ab053959a7d6359 Mon Sep 17 00:00:00 2001
From: Julien Rioux <[email protected]>
Date: Tue, 29 Nov 2011 05:30:41 -0500
Subject: [PATCH] Remove inacurate warning and .aux file left over by lilypond-book.

---
 python/book_latex.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/python/book_latex.py b/python/book_latex.py
index c94240c..fcd539a 100644
--- a/python/book_latex.py
+++ b/python/book_latex.py
@@ -174,8 +174,10 @@ def get_latex_textwidth (source, global_options):
     latex_document = LATEX_INSPECTION_DOCUMENT % {'preamble': preamble}
 
     (handle, tmpfile) = tempfile.mkstemp('.tex')
-    logfile = os.path.splitext (tmpfile)[0] + '.log'
-    logfile = os.path.split (logfile)[1]
+    tmpfileroot = os.path.splitext (tmpfile)[0]
+    tmpfileroot = os.path.split (tmpfileroot)[1]
+    auxfile = tmpfileroot + '.aux'
+    logfile = tmpfileroot + '.log'
 
     tmp_handle = os.fdopen (handle,'w')
     tmp_handle.write (latex_document)
@@ -187,11 +189,13 @@ def get_latex_textwidth (source, global_options):
     proc = subprocess.Popen (cmd,
         universal_newlines=True, shell=True,
         stdout=subprocess.PIPE, stderr=subprocess.PIPE);
+    (parameter_string, error_string) = proc.communicate ()
     if proc.returncode != 0:
         warning (_ ("Unable to auto-detect default page settings:\n%s")
-                 % proc.communicate ()[1]);
+                 % error_string);
     os.unlink (tmpfile)
-    parameter_string = ""
+    if os.path.exists (auxfile):
+        os.unlink (auxfile)
     if os.path.exists (logfile):
         parameter_string = file (logfile).read()
         os.unlink (logfile)
-- 
1.7.4.1

_______________________________________________
lilypond-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to