annotate contrib/packaging/inno/build.py @ 42015:dbca2e5563c3

perf: document config options We have configuration, so we better document it.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 25 Mar 2019 13:43:40 +0100
parents dc7827a9ba64
children 57645939df59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41853
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python3
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 # build.py - Inno installer build script.
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 #
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 #
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 # This software may be used and distributed according to the terms of the
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 # GNU General Public License version 2 or any later version.
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 # This script automates the building of the Inno MSI installer for Mercurial.
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 # no-check-code because Python 3 native.
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 import argparse
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 import os
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 import pathlib
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 import sys
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 if __name__ == '__main__':
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 parser = argparse.ArgumentParser()
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22 parser.add_argument('--python',
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 required=True,
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 help='path to python.exe to use')
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 parser.add_argument('--iscc',
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 help='path to iscc.exe to use')
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 parser.add_argument('--version',
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28 help='Mercurial version string to use '
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 '(detected from __version__.py if not defined')
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 args = parser.parse_args()
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 if args.iscc:
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 iscc = pathlib.Path(args.iscc)
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 else:
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 iscc = (pathlib.Path(os.environ['ProgramFiles(x86)']) / 'Inno Setup 5' /
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 'ISCC.exe')
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 here = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 source_dir = here.parent.parent.parent
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 build_dir = source_dir / 'build'
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 sys.path.insert(0, str(source_dir / 'contrib' / 'packaging'))
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44
41911
dc7827a9ba64 packaging: move Inno Setup core logic into a module
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41910
diff changeset
45 from hgpackaging.inno import build
dc7827a9ba64 packaging: move Inno Setup core logic into a module
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41910
diff changeset
46
41853
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 build(source_dir, build_dir, pathlib.Path(args.python), iscc,
d7dc4ac1ff84 inno: script to automate building Inno installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
48 version=args.version)