Mercurial > hg
annotate contrib/packaging/hgpackaging/cli.py @ 51715:7601978f9e9f
typing: add type hints to `cmdutil.findrepo()`
Since 10db46e128d4, pytype almost figured this out, going from `Any` -> `_T0`,
but the intent is obvious.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 18 Jul 2024 19:55:51 -0400 |
parents | f40fb4c52594 |
children |
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 |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
23 def build_inno(pyoxidizer_target, iscc=None, version=None): |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 if iscc: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 iscc = pathlib.Path(iscc) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 else: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 iscc = ( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 pathlib.Path(os.environ["ProgramFiles(x86)"]) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 / "Inno Setup 5" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 / "ISCC.exe" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 build_dir = SOURCE_DIR / "build" |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
35 inno.build_with_pyoxidizer( |
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
36 SOURCE_DIR, build_dir, pyoxidizer_target, iscc, version=version |
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
37 ) |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 def build_wix( |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
41 pyoxidizer_target, |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 name=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 version=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 sign_sn=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 sign_cert=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 sign_password=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 sign_timestamp_url=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 extra_wxs=None, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 extra_features=None, |
47644
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
50 extra_pyoxidizer_vars=None, |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 ): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 kwargs = { |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 "source_dir": SOURCE_DIR, |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 "version": version, |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
55 "target_triple": pyoxidizer_target, |
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
56 "extra_pyoxidizer_vars": extra_pyoxidizer_vars, |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 } |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 if extra_wxs: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 kwargs["extra_wxs"] = dict( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 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
|
62 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 if extra_features: |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 kwargs["extra_features"] = extra_features.split(",") |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 if sign_sn or sign_cert: |
44765
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
67 kwargs["signing_info"] = { |
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
68 "name": name, |
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
69 "subject_name": sign_sn, |
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
70 "cert_path": sign_cert, |
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
71 "cert_password": sign_password, |
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
72 "timestamp_url": sign_timestamp_url, |
a39984091380
packaging: integrate signing into run_wix_packaging()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44763
diff
changeset
|
73 } |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
75 wix.build_installer_pyoxidizer(**kwargs) |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 def get_parser(): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 parser = argparse.ArgumentParser() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 subparsers = parser.add_subparsers() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 sp = subparsers.add_parser("inno", help="Build Inno Setup installer") |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43513
diff
changeset
|
84 sp.add_argument( |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43513
diff
changeset
|
85 "--pyoxidizer-target", |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43513
diff
changeset
|
86 choices={"i686-pc-windows-msvc", "x86_64-pc-windows-msvc"}, |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
87 required=True, |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43513
diff
changeset
|
88 help="Build with PyOxidizer targeting this host triple", |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43513
diff
changeset
|
89 ) |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 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
|
91 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 "--version", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 help="Mercurial version string to use " |
49079
f40fb4c52594
packaging: add a missing parenthesis to help text
Matt Harbison <matt_harbison@yahoo.com>
parents:
48848
diff
changeset
|
94 "(detected from __version__.py if not defined)", |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 sp.set_defaults(func=build_inno) |
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 = subparsers.add_parser( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 "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
|
100 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 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
|
102 sp.add_argument( |
44767
234882d17814
packaging: support building WiX installers with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44765
diff
changeset
|
103 "--pyoxidizer-target", |
234882d17814
packaging: support building WiX installers with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44765
diff
changeset
|
104 choices={"i686-pc-windows-msvc", "x86_64-pc-windows-msvc"}, |
48848
17d5e25b8e78
packaging: remove py2exe / Python 2.7 support
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47881
diff
changeset
|
105 required=True, |
44767
234882d17814
packaging: support building WiX installers with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44765
diff
changeset
|
106 help="Build with PyOxidizer targeting this host triple", |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
107 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
108 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
109 "--sign-sn", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
110 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
|
111 "to use for signing", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
112 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
113 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
114 "--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
|
115 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
116 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
|
117 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
118 "--sign-timestamp-url", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 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
|
120 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 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
|
122 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 "--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
|
124 ) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
125 sp.add_argument( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
126 "--extra-features", |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
127 help=( |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
128 "CSV of extra feature names to include " |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
129 "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
|
130 ), |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
131 ) |
47644
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
132 |
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
133 sp.add_argument( |
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
134 "--extra-pyoxidizer-vars", |
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
135 help="json map of extra variables to pass to pyoxidizer", |
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
136 ) |
be37bb8d0c7c
packaging: add command line flag to add extra vars to pyoxidizer
Augie Fackler <augie@google.com>
parents:
45942
diff
changeset
|
137 |
43513
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
138 sp.set_defaults(func=build_wix) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
140 return parser |
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 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 def main(): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
144 parser = get_parser() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
145 args = parser.parse_args() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
146 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
147 if not hasattr(args, "func"): |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
148 parser.print_help() |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
149 return |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
150 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
151 kwargs = dict(vars(args)) |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
152 del kwargs["func"] |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
153 |
081a77df7bc6
packaging: consolidate CLI functionality into packaging.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
154 args.func(**kwargs) |