Show More
@@ -18,7 +18,10 b' from .py2exe import (' | |||
|
18 | 18 | build_py2exe, |
|
19 | 19 | stage_install, |
|
20 | 20 | ) |
|
21 |
from .util import |
|
|
21 | from .util import ( | |
|
22 | find_vc_runtime_files, | |
|
23 | read_version_py, | |
|
24 | ) | |
|
22 | 25 | |
|
23 | 26 | EXTRA_PACKAGES = { |
|
24 | 27 | 'dulwich', |
@@ -149,8 +152,10 b' def build(' | |||
|
149 | 152 | if vc_x64: |
|
150 | 153 | args.append('/dARCH=x64') |
|
151 | 154 | |
|
152 | if version: | |
|
153 | args.append('/dVERSION=%s' % version) | |
|
155 | if not version: | |
|
156 | version = read_version_py(source_dir) | |
|
157 | ||
|
158 | args.append('/dVERSION=%s' % version) | |
|
154 | 159 | |
|
155 | 160 | args.append('/Odist') |
|
156 | 161 | args.append(str(inno_build_dir / 'mercurial.iss')) |
@@ -12,6 +12,7 b' import getpass' | |||
|
12 | 12 | import glob |
|
13 | 13 | import os |
|
14 | 14 | import pathlib |
|
15 | import re | |
|
15 | 16 | import shutil |
|
16 | 17 | import subprocess |
|
17 | 18 | import tarfile |
@@ -210,3 +211,16 b' def process_install_rules(' | |||
|
210 | 211 | full_dest_path.parent.mkdir(parents=True, exist_ok=True) |
|
211 | 212 | shutil.copy(full_source_path, full_dest_path) |
|
212 | 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 | 1 | ; Script generated by the Inno Setup Script Wizard. |
|
2 | 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 | 4 | #ifndef ARCH |
|
20 | 5 | #define ARCH = "x86" |
|
21 | 6 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now