]> git.lyx.org Git - lyx.git/commitdiff
configure.py : subprocess, second try (check_output requires
authorJulien Rioux <jrioux@lyx.org>
Fri, 26 Aug 2011 23:29:37 +0000 (23:29 +0000)
committerJulien Rioux <jrioux@lyx.org>
Fri, 26 Aug 2011 23:29:37 +0000 (23:29 +0000)
python 2.7 and throws unwanted exceptions when the process
return value is not 0

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39533 a592a061-630c-0410-9148-cb99ea01b6c8

lib/configure.py

index 9fbba18799d6b8c24360ace18a8b36195553f32c..d810662e6dc0f7b36e64e3a0bd87b7030c084422 100644 (file)
@@ -60,7 +60,9 @@ def cmdOutput(cmd):
     '''utility function: run a command and get its output as a string
         cmd: command to run
     '''
-    output = subprocess.check_output(cmd, shell=True)
+    fout = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
+    output = fout.read()
+    fout.close()
     return output.strip()
 
 
@@ -640,9 +642,14 @@ def checkConverterEntries():
     checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'], 
         rc_entry = [ r'\converter sweave      r      "%%"    ""' ])
     #
-    checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \
-        'htmltolatex -input $$i -output $$o', 'java -jar htmltolatex.jar -input $$i -output $$o'],
-        rc_entry = [ r'\converter html       latex      "%%"   ""' ])
+    path, htmltolatex = checkProg('an HTML -> LaTeX converter', ['html2latex $$i',
+        'gnuhtml2latex $$i', 'htmltolatex -input $$i -output $$o', 'htmltolatex.jar'],
+        rc_entry = [ r'\converter html       latex      "%%"   ""',
+                     r'\converter html       latex      "%%"   ""',
+                     r'\converter html       latex      "%%"   ""', '', ''] )
+    if htmltolatex == 'htmltolatex.jar':
+        addToRC(r'\converter html       latex      "java -jar %s -input $$i -output $$o"       ""'
+            % os.path.join(path, htmltolatex))
     #
     checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
         rc_entry = [ r'\converter word       latex      "%%"   ""' ])