##// END OF EJS Templates
packaging: add a missing parenthesis to help text...
Matt Harbison -
r49952:04837f01 default draft
parent child Browse files
Show More
@@ -1,154 +1,154 b''
1 1 # cli.py - Command line interface for automation
2 2 #
3 3 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 # no-check-code because Python 3 native.
9 9
10 10 import argparse
11 11 import os
12 12 import pathlib
13 13
14 14 from . import (
15 15 inno,
16 16 wix,
17 17 )
18 18
19 19 HERE = pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
20 20 SOURCE_DIR = HERE.parent.parent.parent
21 21
22 22
23 23 def build_inno(pyoxidizer_target, iscc=None, version=None):
24 24 if iscc:
25 25 iscc = pathlib.Path(iscc)
26 26 else:
27 27 iscc = (
28 28 pathlib.Path(os.environ["ProgramFiles(x86)"])
29 29 / "Inno Setup 5"
30 30 / "ISCC.exe"
31 31 )
32 32
33 33 build_dir = SOURCE_DIR / "build"
34 34
35 35 inno.build_with_pyoxidizer(
36 36 SOURCE_DIR, build_dir, pyoxidizer_target, iscc, version=version
37 37 )
38 38
39 39
40 40 def build_wix(
41 41 pyoxidizer_target,
42 42 name=None,
43 43 version=None,
44 44 sign_sn=None,
45 45 sign_cert=None,
46 46 sign_password=None,
47 47 sign_timestamp_url=None,
48 48 extra_wxs=None,
49 49 extra_features=None,
50 50 extra_pyoxidizer_vars=None,
51 51 ):
52 52 kwargs = {
53 53 "source_dir": SOURCE_DIR,
54 54 "version": version,
55 55 "target_triple": pyoxidizer_target,
56 56 "extra_pyoxidizer_vars": extra_pyoxidizer_vars,
57 57 }
58 58
59 59 if extra_wxs:
60 60 kwargs["extra_wxs"] = dict(
61 61 thing.split("=") for thing in extra_wxs.split(",")
62 62 )
63 63 if extra_features:
64 64 kwargs["extra_features"] = extra_features.split(",")
65 65
66 66 if sign_sn or sign_cert:
67 67 kwargs["signing_info"] = {
68 68 "name": name,
69 69 "subject_name": sign_sn,
70 70 "cert_path": sign_cert,
71 71 "cert_password": sign_password,
72 72 "timestamp_url": sign_timestamp_url,
73 73 }
74 74
75 75 wix.build_installer_pyoxidizer(**kwargs)
76 76
77 77
78 78 def get_parser():
79 79 parser = argparse.ArgumentParser()
80 80
81 81 subparsers = parser.add_subparsers()
82 82
83 83 sp = subparsers.add_parser("inno", help="Build Inno Setup installer")
84 84 sp.add_argument(
85 85 "--pyoxidizer-target",
86 86 choices={"i686-pc-windows-msvc", "x86_64-pc-windows-msvc"},
87 87 required=True,
88 88 help="Build with PyOxidizer targeting this host triple",
89 89 )
90 90 sp.add_argument("--iscc", help="path to iscc.exe to use")
91 91 sp.add_argument(
92 92 "--version",
93 93 help="Mercurial version string to use "
94 "(detected from __version__.py if not defined",
94 "(detected from __version__.py if not defined)",
95 95 )
96 96 sp.set_defaults(func=build_inno)
97 97
98 98 sp = subparsers.add_parser(
99 99 "wix", help="Build Windows installer with WiX Toolset"
100 100 )
101 101 sp.add_argument("--name", help="Application name", default="Mercurial")
102 102 sp.add_argument(
103 103 "--pyoxidizer-target",
104 104 choices={"i686-pc-windows-msvc", "x86_64-pc-windows-msvc"},
105 105 required=True,
106 106 help="Build with PyOxidizer targeting this host triple",
107 107 )
108 108 sp.add_argument(
109 109 "--sign-sn",
110 110 help="Subject name (or fragment thereof) of certificate "
111 111 "to use for signing",
112 112 )
113 113 sp.add_argument(
114 114 "--sign-cert", help="Path to certificate to use for signing"
115 115 )
116 116 sp.add_argument("--sign-password", help="Password for signing certificate")
117 117 sp.add_argument(
118 118 "--sign-timestamp-url",
119 119 help="URL of timestamp server to use for signing",
120 120 )
121 121 sp.add_argument("--version", help="Version string to use")
122 122 sp.add_argument(
123 123 "--extra-wxs", help="CSV of path_to_wxs_file=working_dir_for_wxs_file"
124 124 )
125 125 sp.add_argument(
126 126 "--extra-features",
127 127 help=(
128 128 "CSV of extra feature names to include "
129 129 "in the installer from the extra wxs files"
130 130 ),
131 131 )
132 132
133 133 sp.add_argument(
134 134 "--extra-pyoxidizer-vars",
135 135 help="json map of extra variables to pass to pyoxidizer",
136 136 )
137 137
138 138 sp.set_defaults(func=build_wix)
139 139
140 140 return parser
141 141
142 142
143 143 def main():
144 144 parser = get_parser()
145 145 args = parser.parse_args()
146 146
147 147 if not hasattr(args, "func"):
148 148 parser.print_help()
149 149 return
150 150
151 151 kwargs = dict(vars(args))
152 152 del kwargs["func"]
153 153
154 154 args.func(**kwargs)
General Comments 0
You need to be logged in to leave comments. Login now