summaryrefslogtreecommitdiffstats
path: root/test/TEX/TEX.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/TEX/TEX.py')
-rw-r--r--test/TEX/TEX.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/TEX/TEX.py b/test/TEX/TEX.py
index 7b20106..3964eb8 100644
--- a/test/TEX/TEX.py
+++ b/test/TEX/TEX.py
@@ -24,7 +24,7 @@ from __future__ import print_function
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-"""
+r"""
Validate that we can set the TEX string to our own utility, that
the produced .dvi, .aux and .log files get removed by the -c option,
and that we can use this to wrap calls to the real latex utility.
@@ -47,15 +47,16 @@ import os
import getopt
cmd_opts, arg = getopt.getopt(sys.argv[1:], 'i:r:', [])
base_name = os.path.splitext(arg[0])[0]
-infile = open(arg[0], 'r')
-dvi_file = open(base_name+'.dvi', 'w')
-aux_file = open(base_name+'.aux', 'w')
-log_file = open(base_name+'.log', 'w')
-for l in infile.readlines():
- if l[0] != '\\':
- dvi_file.write(l)
- aux_file.write(l)
- log_file.write(l)
+with open(arg[0], 'r') as ifp:
+ with open(base_name+'.dvi', 'w') as dvi_file, \
+ open(base_name+'.aux', 'w') as aux_file, \
+ open(base_name+'.log', 'w') as log_file:
+
+ for l in ifp.readlines():
+ if l[0] != '\\':
+ dvi_file.write(l)
+ aux_file.write(l)
+ log_file.write(l)
sys.exit(0)
""")