##// END OF EJS Templates
packaging: always pass VERSION into Inno invocation...
Gregory Szorc -
r43824:cf5eaf24 default draft
parent child Browse files
Show More
@@ -18,7 +18,10 b' from .py2exe import ('
18 build_py2exe,
18 build_py2exe,
19 stage_install,
19 stage_install,
20 )
20 )
21 from .util import find_vc_runtime_files
21 from .util import (
22 find_vc_runtime_files,
23 read_version_py,
24 )
22
25
23 EXTRA_PACKAGES = {
26 EXTRA_PACKAGES = {
24 'dulwich',
27 'dulwich',
@@ -149,8 +152,10 b' def build('
149 if vc_x64:
152 if vc_x64:
150 args.append('/dARCH=x64')
153 args.append('/dARCH=x64')
151
154
152 if version:
155 if not version:
153 args.append('/dVERSION=%s' % version)
156 version = read_version_py(source_dir)
157
158 args.append('/dVERSION=%s' % version)
154
159
155 args.append('/Odist')
160 args.append('/Odist')
156 args.append(str(inno_build_dir / 'mercurial.iss'))
161 args.append(str(inno_build_dir / 'mercurial.iss'))
@@ -12,6 +12,7 b' import getpass'
12 import glob
12 import glob
13 import os
13 import os
14 import pathlib
14 import pathlib
15 import re
15 import shutil
16 import shutil
16 import subprocess
17 import subprocess
17 import tarfile
18 import tarfile
@@ -210,3 +211,16 b' def process_install_rules('
210 full_dest_path.parent.mkdir(parents=True, exist_ok=True)
211 full_dest_path.parent.mkdir(parents=True, exist_ok=True)
211 shutil.copy(full_source_path, full_dest_path)
212 shutil.copy(full_source_path, full_dest_path)
212 print('copying %s to %s' % (full_source_path, full_dest_path))
213 print('copying %s to %s' % (full_source_path, full_dest_path))
214
215
216 def read_version_py(source_dir):
217 """Read the mercurial/__version__.py file to resolve the version string."""
218 p = source_dir / 'mercurial' / '__version__.py'
219
220 with p.open('r', encoding='utf-8') as fh:
221 m = re.search('version = b"([^"]+)"', fh.read(), re.MULTILINE)
222
223 if not m:
224 raise Exception('could not parse %s' % p)
225
226 return m.group(1)
@@ -1,21 +1,6 b''
1 ; Script generated by the Inno Setup Script Wizard.
1 ; Script generated by the Inno Setup Script Wizard.
2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
2 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3
3
4 #ifndef VERSION
5 #define FileHandle
6 #define FileLine
7 #define VERSION = "unknown"
8 #if FileHandle = FileOpen(SourcePath + "\..\..\mercurial\__version__.py")
9 #expr FileLine = FileRead(FileHandle)
10 #expr FileLine = FileRead(FileHandle)
11 #define VERSION = Copy(FileLine, Pos('"', FileLine)+1, Len(FileLine)-Pos('"', FileLine)-1)
12 #endif
13 #if FileHandle
14 #expr FileClose(FileHandle)
15 #endif
16 #pragma message "Detected Version: " + VERSION
17 #endif
18
19 #ifndef ARCH
4 #ifndef ARCH
20 #define ARCH = "x86"
5 #define ARCH = "x86"
21 #endif
6 #endif
General Comments 0
You need to be logged in to leave comments. Login now