commit 90df39d491dfd72f0cd40dcda1b94b2df676936e
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Sep 10 17:02:58 2017 +0200

    svg2*tex.py: use subprocess in order to handle path with spaces.
    
    See #10679
---
 lib/scripts/svg2pdftex.py |    6 +++---
 lib/scripts/svg2pstex.py  |    7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/scripts/svg2pdftex.py b/lib/scripts/svg2pdftex.py
index 06b5428..56ac22e 100644
--- a/lib/scripts/svg2pdftex.py
+++ b/lib/scripts/svg2pdftex.py
@@ -27,13 +27,13 @@
 #   the real PDF file would be overwritten by a TeX file named outputfile.pdf.
 #
 
-import os, sys, re
+import os, sys, re, subprocess
 
 def runCommand(cmd):
     ''' Utility function:
         run a command, quit if fails
     '''
-    if os.system(cmd) != 0:
+    if subprocess.call(cmd) != 0:
         print "Command '%s' fails." % cmd
         sys.exit(1)
 
@@ -65,7 +65,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('%s --file=%s --export-pdf=%s.pdf --export-latex' % (InkscapeCmd, 
InputFile, OutBase))
+runCommand([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 238afb6..246537b 100644
--- a/lib/scripts/svg2pstex.py
+++ b/lib/scripts/svg2pstex.py
@@ -30,13 +30,13 @@
 # This script converts an SVG image to something that latex can process
 # into high quality PostScript.
 
-import os, sys
+import os, sys, re, subprocess
 
 def runCommand(cmd):
     ''' Utility function:
         run a command, quit if fails
     '''
-    if os.system(cmd) != 0:
+    if subprocess.call(cmd) != 0:
         print "Command '%s' fails." % cmd
         sys.exit(1)
 
@@ -68,6 +68,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('%s --file=%s --export-eps=%s.eps --export-latex' % (InkscapeCmd, 
InputFile, OutBase))
+runCommand([InkscapeCmd, '--file=%s' % (InputFile), '--export-eps=%s.eps' % 
(OutBase), '--export-latex'])
+
 os.rename('%s.eps_tex' % OutBase, OutputFile)
 

Reply via email to