commit e8dd6702fdb1e1146531538a9d48132854a6ede1
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Tue Sep 12 07:57:29 2017 +0200

    svg2*tex.py: final fixes for Windows
    
    Fixes: #10679
---
 lib/scripts/svg2pdftex.py |    7 ++++---
 lib/scripts/svg2pstex.py  |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/scripts/svg2pdftex.py b/lib/scripts/svg2pdftex.py
index 56ac22e..c574e6a 100644
--- a/lib/scripts/svg2pdftex.py
+++ b/lib/scripts/svg2pdftex.py
@@ -33,8 +33,9 @@ def runCommand(cmd):
     ''' Utility function:
         run a command, quit if fails
     '''
-    if subprocess.call(cmd) != 0:
-        print "Command '%s' fails." % cmd
+    res = subprocess.check_call(cmd)
+    if res != 0:
+        print "Command '%s' fails (exit code: %i)." % (res.cmd, res.returncode)
         sys.exit(1)
 
 InkscapeCmd = "inkscape"
@@ -65,7 +66,7 @@ OutBase = os.path.splitext(OutputFile)[0]
 # while outsourcing the text to a LaTeX file ${OutBase}.pdf_tex which includes 
and overlays
 # the PDF image and can be \input to LaTeX files. We rename the latter file to 
${OutputFile}
 # (although this is probably the name it already has).
-runCommand([InkscapeCmd, '--file=%s' % (InputFile), '--export-pdf=%s.pdf' % 
(OutBase), '--export-latex'])
+runCommand([r'%s' % InkscapeCmd, '--file=%s' % InputFile, 
'--export-pdf=%s.pdf' % OutBase, '--export-latex'])
 
 os.rename('%s.pdf_tex' % OutBase, OutputFile)
 
diff --git a/lib/scripts/svg2pstex.py b/lib/scripts/svg2pstex.py
index 246537b..0195e26 100644
--- a/lib/scripts/svg2pstex.py
+++ b/lib/scripts/svg2pstex.py
@@ -36,8 +36,9 @@ def runCommand(cmd):
     ''' Utility function:
         run a command, quit if fails
     '''
-    if subprocess.call(cmd) != 0:
-        print "Command '%s' fails." % cmd
+    res = subprocess.check_call(cmd)
+    if res != 0:
+        print "Command '%s' fails (exit code: %i)." % (res.cmd, res.returncode)
         sys.exit(1)
 
 InkscapeCmd = "inkscape"
@@ -68,7 +69,7 @@ OutBase = os.path.splitext(OutputFile)[0]
 # while outsourcing the text to a LaTeX file ${OutBase}.eps_tex which includes 
and overlays
 # the EPS image and can be \input to LaTeX files. We rename the latter file to 
${OutputFile}
 # (although this is probably the name it already has).
-runCommand([InkscapeCmd, '--file=%s' % (InputFile), '--export-eps=%s.eps' % 
(OutBase), '--export-latex'])
+runCommand([r'%s' % InkscapeCmd, '--file=%s' % InputFile, 
'--export-eps=%s.eps' % OutBase, '--export-latex'])
 
 os.rename('%s.eps_tex' % OutBase, OutputFile)
 

Reply via email to