|
1 | 1 | #!/usr/bin/env python
|
2 | 2 |
|
3 |
| -import argh |
| 3 | +import argparse |
4 | 4 | import subprocess
|
5 | 5 | import os
|
6 | 6 |
|
|
29 | 29 | updates_signing_key_file = os.path.join(project_root, 'updates', 'gitx-updates.key')
|
30 | 30 | updates_appcast_file = 'GitX-dev.xml'
|
31 | 31 |
|
32 |
| -clean = "" |
33 | 32 | pause = 3
|
34 | 33 |
|
35 | 34 | build_base_dir = os.path.join(project_root, "build")
|
36 | 35 |
|
37 | 36 | class BuildError(RuntimeError):
|
38 | 37 | pass
|
39 | 38 |
|
40 |
| -@argh.arg("config", choices=['debug', 'release']) |
41 |
| -def clean(config): |
42 |
| - clean_scheme(scheme, config) |
| 39 | +def clean(args): |
| 40 | + clean_scheme(scheme, args.config) |
43 | 41 |
|
44 | 42 | def release():
|
45 | 43 | try:
|
@@ -101,11 +99,10 @@ def prepare_release(build_number, image_source_path):
|
101 | 99 | shutil.copyfile(release_notes_file, publish_release_notes_version_file)
|
102 | 100 |
|
103 | 101 |
|
104 |
| -@argh.arg("scheme", choices=['debug', 'release']) |
105 |
| -def build(scheme): |
106 |
| - if scheme == "debug": |
| 102 | +def build(args): |
| 103 | + if args.config == "debug": |
107 | 104 | debug()
|
108 |
| - if scheme == "release": |
| 105 | + if args.config == "release": |
109 | 106 | release()
|
110 | 107 |
|
111 | 108 |
|
@@ -168,4 +165,17 @@ def package_app(app_path, image_path, image_name):
|
168 | 165 |
|
169 | 166 | if __name__ == "__main__":
|
170 | 167 | script_dir = os.path.dirname(os.path.abspath(__file__))
|
171 |
| - argh.dispatch_commands([clean, build]) |
| 168 | + |
| 169 | + parser = argparse.ArgumentParser() |
| 170 | + subparsers = parser.add_subparsers() |
| 171 | + |
| 172 | + parser_config = subparsers.add_parser('config') |
| 173 | + parser_config.add_argument('config', choices=['debug', 'release']) |
| 174 | + parser_config.set_defaults(func=clean) |
| 175 | + |
| 176 | + parser_build = subparsers.add_parser('build') |
| 177 | + parser_build.add_argument('config', choices=['debug', 'release']) |
| 178 | + parser_build.set_defaults(func=build) |
| 179 | + |
| 180 | + args = parser.parse_args() |
| 181 | + args.func(args) |
0 commit comments