-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign_bin.py
54 lines (47 loc) · 1.23 KB
/
sign_bin.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
import argparse
import os
import pathlib
import sys
from subprocess import STDOUT, check_call
if sys.platform != "darwin":
raise NotImplementedError
parser = argparse.ArgumentParser()
parser.add_argument(
"--application-id",
required=True,
help="Certificate ID (should be added to the keychain).",
)
parser.add_argument(
"--keychain",
required=False,
help="Specify a specific keychain to search for the signing identity.",
)
args = parser.parse_args()
path = pathlib.Path(__file__).parent.absolute()
dvc = path / "dist" / "dvc"
flags = []
if args.keychain:
flags.extend(["--keychain", args.keychain])
for root, _, fnames in os.walk(dvc):
for fname in fnames:
_, ext = os.path.splitext(fname)
fpath = os.path.join(root, fname)
print(f"signing {fpath}")
check_call(
[
"codesign",
"-s",
args.application_id,
*flags,
"-f",
"-v",
"--timestamp",
"-o",
"runtime",
"--entitlements",
"entitlements.plist",
fpath,
],
timeout=10,
stderr=STDOUT,
)