Replace the deprecated os.popen3 with the subprocess module.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35162 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2010-08-19 07:00:41 +00:00
parent 9ea72a7483
commit d0d7db958c

View File

@ -28,7 +28,7 @@ It requires dv2dt and dt2dv from the DTL dviware package
http://www.ctan.org/tex-archive/dviware/dtl/ http://www.ctan.org/tex-archive/dviware/dtl/
''' '''
import os, re, sys import os, re, subprocess, sys
def usage(prog_name): def usage(prog_name):
return 'Usage: %s in.dvi out.dvi\n' \ return 'Usage: %s in.dvi out.dvi\n' \
@ -79,9 +79,16 @@ def main(argv):
error('Unable to read "%s"\n' % infile) error('Unable to read "%s"\n' % infile)
# Convert the input .dvi file to .dtl format. # Convert the input .dvi file to .dtl format.
if os.name == 'nt':
unix = False
else:
unix = True
dv2dt_call = 'dv2dt "%s"' % infile dv2dt_call = 'dv2dt "%s"' % infile
dv2dt_stdin, dv2dt_stdout, dv2dt_stderr = \ dv2dt_pipe = subprocess.Popen(dv2dt_call, universal_newlines=True, \
os.popen3(dv2dt_call, 't') stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, \
shell=unix, close_fds=unix)
(dv2dt_stdin, dv2dt_stdout, dv2dt_stderr) = \
(dv2dt_pipe.stdin, dv2dt_pipe.stdout, dv2dt_pipe.stderr)
dv2dt_stdin.close() dv2dt_stdin.close()
dv2dt_data = dv2dt_stdout.read() dv2dt_data = dv2dt_stdout.read()