-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotarize_installer.py
71 lines (60 loc) · 1.61 KB
/
notarize_installer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import argparse
import json
import os
import pathlib
import sys
from subprocess import STDOUT, check_call
if sys.platform != "darwin":
raise NotImplementedError
parser = argparse.ArgumentParser()
parser.add_argument(
"path",
nargs="?",
help="Path to the osxpkg to notarize. If not specified - try to find one.",
)
parser.add_argument("--apple-id-username", required=True, help="Apple ID username.")
parser.add_argument(
"--apple-id-password",
required=True,
help=(
"Apple ID app-specific password. Note that this is not a regular "
"Apple ID password, so you need to generate one at "
"https://appleid.apple.com/account/manage"
),
)
parser.add_argument(
"--apple-id-provider",
required=True,
help="The App Store Connect provider when using multiple teams within App Store Connect",
)
args = parser.parse_args()
path = pathlib.Path(__file__).parent.absolute()
if args.path:
pkg = pathlib.Path(args.path)
else:
pkgs = list(path.glob("*.pkg"))
if not pkgs:
print("No pkgs found")
sys.exit(1)
if len(pkgs) > 1:
print("Too many packages")
sys.exit(1)
(pkg,) = pkgs
config = {
"notarize": {
"path": os.fspath(pkg),
"bundle_id": "com.iterative.dvc",
"staple": True,
},
"apple_id": {
"username": args.apple_id_username,
"password": args.apple_id_password,
"provider": args.apple_id_provider,
},
}
(path / "config.json").write_text(json.dumps(config))
check_call(
["gon", "-log-level=info", "-log-json", "config.json"],
cwd=path,
stderr=STDOUT,
)