Commit f75f4e2 1 parent 01ab67c commit f75f4e2 Copy full SHA for f75f4e2
File tree 1 file changed +25
-8
lines changed
1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change 17
17
import sys
18
18
19
19
import em
20
+ try :
21
+ from em import Configuration
22
+ em_has_configuration = True
23
+ except ImportError :
24
+ em_has_configuration = False
25
+
20
26
try :
21
27
import importlib .resources as importlib_resources
22
28
except ModuleNotFoundError :
25
31
26
32
def _expand_template (template_file , data , output_file ):
27
33
output = StringIO ()
28
- interpreter = em .Interpreter (
29
- output = output ,
30
- options = {
31
- em .BUFFERED_OPT : True ,
32
- em .RAW_OPT : True ,
33
- },
34
- globals = data ,
35
- )
34
+ if em_has_configuration :
35
+ config = Configuration (
36
+ defaultStdout = output ,
37
+ deleteOnError = True ,
38
+ rawErrors = True ,
39
+ useProxy = True )
40
+ interpreter = em .Interpreter (
41
+ config = config ,
42
+ dispatcher = False ,
43
+ globals = data )
44
+ else :
45
+ interpreter = em .Interpreter (
46
+ output = output ,
47
+ options = {
48
+ em .BUFFERED_OPT : True ,
49
+ em .RAW_OPT : True ,
50
+ },
51
+ globals = data )
52
+
36
53
with open (template_file , 'r' ) as h :
37
54
try :
38
55
interpreter .file (h )
You can’t perform that action at this time.
0 commit comments