Mercurial > hg
annotate contrib/packaging/hgpackaging/cli.py @ 43697:dc4e74d0ef96
py3: send bytes from Rust-created warning patterns
Python code expects bytes in both Python 2 and Python 3, so we should send
bytes.
Differential Revision: https://phab.mercurial-scm.org/D7454
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 18 Nov 2019 17:37:59 +0100 |
parents | 081a77df7bc6 |
children | 94f4f2ec7dee |
rev | line source |
---|---|
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # cli.py - Command line interface for automation |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 # |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 # |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 # no-check-code because Python 3 native. |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 import argparse |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 import os |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 import pathlib |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 from . import ( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 inno, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 wix, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 HERE = pathlib.Path(os.path.abspath(os.path.dirname(__file__))) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 SOURCE_DIR = HERE.parent.parent.parent |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 def build_inno(python=None, iscc=None, version=None): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 if not os.path.isabs(python): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 raise Exception("--python arg must be an absolute path") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 if iscc: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 iscc = pathlib.Path(iscc) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 else: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 iscc = ( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 pathlib.Path(os.environ["ProgramFiles(x86)"]) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 / "Inno Setup 5" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 / "ISCC.exe" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 build_dir = SOURCE_DIR / "build" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 inno.build( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 SOURCE_DIR, build_dir, pathlib.Path(python), iscc, version=version, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 def build_wix( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 name=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 python=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 version=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 sign_sn=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 sign_cert=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 sign_password=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 sign_timestamp_url=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 extra_packages_script=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 extra_wxs=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 extra_features=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 ): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 fn = wix.build_installer |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 kwargs = { |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 "source_dir": SOURCE_DIR, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 "python_exe": pathlib.Path(python), |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 "version": version, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 } |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 if not os.path.isabs(python): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 raise Exception("--python arg must be an absolute path") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 if extra_packages_script: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 kwargs["extra_packages_script"] = extra_packages_script |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 if extra_wxs: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 kwargs["extra_wxs"] = dict( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 thing.split("=") for thing in extra_wxs.split(",") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 if extra_features: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 kwargs["extra_features"] = extra_features.split(",") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 if sign_sn or sign_cert: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 fn = wix.build_signed_installer |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 kwargs["name"] = name |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 kwargs["subject_name"] = sign_sn |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 kwargs["cert_path"] = sign_cert |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 kwargs["cert_password"] = sign_password |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 kwargs["timestamp_url"] = sign_timestamp_url |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 fn(**kwargs) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 def get_parser(): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 parser = argparse.ArgumentParser() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 subparsers = parser.add_subparsers() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 sp = subparsers.add_parser("inno", help="Build Inno Setup installer") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 sp.add_argument("--python", required=True, help="path to python.exe to use") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 sp.add_argument("--iscc", help="path to iscc.exe to use") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 "--version", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 help="Mercurial version string to use " |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 "(detected from __version__.py if not defined", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
98 sp.set_defaults(func=build_inno) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 sp = subparsers.add_parser( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 "wix", help="Build Windows installer with WiX Toolset" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
102 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
103 sp.add_argument("--name", help="Application name", default="Mercurial") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
104 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
105 "--python", help="Path to Python executable to use", required=True |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
106 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
107 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
108 "--sign-sn", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
109 help="Subject name (or fragment thereof) of certificate " |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
110 "to use for signing", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
111 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
112 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
113 "--sign-cert", help="Path to certificate to use for signing" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
114 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
115 sp.add_argument("--sign-password", help="Password for signing certificate") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
116 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
117 "--sign-timestamp-url", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
118 help="URL of timestamp server to use for signing", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 sp.add_argument("--version", help="Version string to use") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
122 "--extra-packages-script", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 help=( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
124 "Script to execute to include extra packages in " "py2exe binary." |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
125 ), |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
126 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
127 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
128 "--extra-wxs", help="CSV of path_to_wxs_file=working_dir_for_wxs_file" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
129 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
130 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
131 "--extra-features", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 help=( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
133 "CSV of extra feature names to include " |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
134 "in the installer from the extra wxs files" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
135 ), |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
136 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
137 sp.set_defaults(func=build_wix) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
138 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 return parser |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
140 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
141 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
142 def main(): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 parser = get_parser() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
144 args = parser.parse_args() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
145 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
146 if not hasattr(args, "func"): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
147 parser.print_help() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
148 return |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
149 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
150 kwargs = dict(vars(args)) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
151 del kwargs["func"] |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
152 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
153 args.func(**kwargs) |