##// END OF EJS Templates
packaging: process Inno Setup files with Jinja2...
Gregory Szorc -
r43915:7bd88d0d default
parent child Browse files
Show More
@@ -12,6 +12,8 b' import pathlib'
12 import shutil
12 import shutil
13 import subprocess
13 import subprocess
14
14
15 import jinja2
16
15 from .py2exe import build_py2exe
17 from .py2exe import build_py2exe
16 from .util import find_vc_runtime_files
18 from .util import find_vc_runtime_files
17
19
@@ -75,9 +77,26 b' def build('
75
77
76 print('creating installer')
78 print('creating installer')
77
79
78 # Copy Inno files into place.
80 # Install Inno files by rendering a template.
79 for p in ('mercurial.iss', 'modpath.iss'):
81 jinja_env = jinja2.Environment(
80 shutil.copyfile(inno_source_dir / p, inno_build_dir / p)
82 loader=jinja2.FileSystemLoader(str(inno_source_dir)),
83 # Need to change these to prevent conflict with Inno Setup.
84 comment_start_string='{##',
85 comment_end_string='##}',
86 )
87
88 try:
89 template = jinja_env.get_template('mercurial.iss')
90 except jinja2.TemplateSyntaxError as e:
91 raise Exception(
92 'template syntax error at %s:%d: %s'
93 % (e.name, e.lineno, e.message,)
94 )
95
96 content = template.render()
97
98 with (inno_build_dir / 'mercurial.iss').open('w', encoding='utf-8') as fh:
99 fh.write(content)
81
100
82 args = [str(iscc_exe)]
101 args = [str(iscc_exe)]
83
102
@@ -40,7 +40,7 b' AppPublisher=Matt Mackall and others'
40 AppPublisherURL=https://mercurial-scm.org/
40 AppPublisherURL=https://mercurial-scm.org/
41 AppSupportURL=https://mercurial-scm.org/
41 AppSupportURL=https://mercurial-scm.org/
42 AppUpdatesURL=https://mercurial-scm.org/
42 AppUpdatesURL=https://mercurial-scm.org/
43 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
43 {{ 'AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}' }}
44 AppContact=mercurial@mercurial-scm.org
44 AppContact=mercurial@mercurial-scm.org
45 DefaultDirName={pf}\Mercurial
45 DefaultDirName={pf}\Mercurial
46 SourceDir=..\..
46 SourceDir=..\..
@@ -121,4 +121,5 b' begin'
121 setArrayLength(Result, 1)
121 setArrayLength(Result, 1)
122 Result[0] := ExpandConstant('{app}');
122 Result[0] := ExpandConstant('{app}');
123 end;
123 end;
124 #include "modpath.iss"
124
125 {% include 'modpath.iss' %}
General Comments 0
You need to be logged in to leave comments. Login now