##// END OF EJS Templates
packaging: ensure that --python is an absolute path when building on Windows...
Matt Harbison -
r42260:57645939 default
parent child Browse files
Show More
@@ -1,48 +1,51 b''
1 1 #!/usr/bin/env python3
2 2 # build.py - Inno installer build script.
3 3 #
4 4 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 9 # This script automates the building of the Inno MSI installer for Mercurial.
10 10
11 11 # no-check-code because Python 3 native.
12 12
13 13 import argparse
14 14 import os
15 15 import pathlib
16 16 import sys
17 17
18 18
19 19 if __name__ == '__main__':
20 20 parser = argparse.ArgumentParser()
21 21
22 22 parser.add_argument('--python',
23 23 required=True,
24 24 help='path to python.exe to use')
25 25 parser.add_argument('--iscc',
26 26 help='path to iscc.exe to use')
27 27 parser.add_argument('--version',
28 28 help='Mercurial version string to use '
29 29 '(detected from __version__.py if not defined')
30 30
31 31 args = parser.parse_args()
32 32
33 if not os.path.isabs(args.python):
34 raise Exception('--python arg must be an absolute path')
35
33 36 if args.iscc:
34 37 iscc = pathlib.Path(args.iscc)
35 38 else:
36 39 iscc = (pathlib.Path(os.environ['ProgramFiles(x86)']) / 'Inno Setup 5' /
37 40 'ISCC.exe')
38 41
39 42 here = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
40 43 source_dir = here.parent.parent.parent
41 44 build_dir = source_dir / 'build'
42 45
43 46 sys.path.insert(0, str(source_dir / 'contrib' / 'packaging'))
44 47
45 48 from hgpackaging.inno import build
46 49
47 50 build(source_dir, build_dir, pathlib.Path(args.python), iscc,
48 51 version=args.version)
@@ -1,81 +1,84 b''
1 1 #!/usr/bin/env python3
2 2 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
3 3 #
4 4 # This software may be used and distributed according to the terms of the
5 5 # GNU General Public License version 2 or any later version.
6 6
7 7 # no-check-code because Python 3 native.
8 8
9 9 """Code to build Mercurial WiX installer."""
10 10
11 11 import argparse
12 12 import os
13 13 import pathlib
14 14 import sys
15 15
16 16
17 17 if __name__ == '__main__':
18 18 parser = argparse.ArgumentParser()
19 19
20 20 parser.add_argument('--name',
21 21 help='Application name',
22 22 default='Mercurial')
23 23 parser.add_argument('--python',
24 24 help='Path to Python executable to use',
25 25 required=True)
26 26 parser.add_argument('--sign-sn',
27 27 help='Subject name (or fragment thereof) of certificate '
28 28 'to use for signing')
29 29 parser.add_argument('--sign-cert',
30 30 help='Path to certificate to use for signing')
31 31 parser.add_argument('--sign-password',
32 32 help='Password for signing certificate')
33 33 parser.add_argument('--sign-timestamp-url',
34 34 help='URL of timestamp server to use for signing')
35 35 parser.add_argument('--version',
36 36 help='Version string to use')
37 37 parser.add_argument('--extra-packages-script',
38 38 help=('Script to execute to include extra packages in '
39 39 'py2exe binary.'))
40 40 parser.add_argument('--extra-wxs',
41 41 help='CSV of path_to_wxs_file=working_dir_for_wxs_file')
42 42 parser.add_argument('--extra-features',
43 43 help=('CSV of extra feature names to include '
44 44 'in the installer from the extra wxs files'))
45 45
46 46 args = parser.parse_args()
47 47
48 48 here = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
49 49 source_dir = here.parent.parent.parent
50 50
51 51 sys.path.insert(0, str(source_dir / 'contrib' / 'packaging'))
52 52
53 53 from hgpackaging.wix import (
54 54 build_installer,
55 55 build_signed_installer,
56 56 )
57 57
58 58 fn = build_installer
59 59 kwargs = {
60 60 'source_dir': source_dir,
61 61 'python_exe': pathlib.Path(args.python),
62 62 'version': args.version,
63 63 }
64 64
65 if not os.path.isabs(args.python):
66 raise Exception('--python arg must be an absolute path')
67
65 68 if args.extra_packages_script:
66 69 kwargs['extra_packages_script'] = args.extra_packages_script
67 70 if args.extra_wxs:
68 71 kwargs['extra_wxs'] = dict(
69 72 thing.split("=") for thing in args.extra_wxs.split(','))
70 73 if args.extra_features:
71 74 kwargs['extra_features'] = args.extra_features.split(',')
72 75
73 76 if args.sign_sn or args.sign_cert:
74 77 fn = build_signed_installer
75 78 kwargs['name'] = args.name
76 79 kwargs['subject_name'] = args.sign_sn
77 80 kwargs['cert_path'] = args.sign_cert
78 81 kwargs['cert_password'] = args.sign_password
79 82 kwargs['timestamp_url'] = args.sign_timestamp_url
80 83
81 84 fn(**kwargs)
General Comments 0
You need to be logged in to leave comments. Login now