(app, notarization_username, notarization_password, notarization_team_id = None)
| 705 | |
| 706 | # https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc |
| 707 | def notarize(app, notarization_username, notarization_password, notarization_team_id = None): |
| 708 | log('Sending editor for notarization') |
| 709 | |
| 710 | args = ['xcrun', 'notarytool', 'submit', |
| 711 | '--progress', |
| 712 | '--output-format', 'json', |
| 713 | '--apple-id', notarization_username, |
| 714 | '--password', notarization_password] |
| 715 | |
| 716 | if notarization_team_id: |
| 717 | args.extend(['--team-id', notarization_team_id]) |
| 718 | |
| 719 | args.append(app) |
| 720 | |
| 721 | res = json.loads(run.command(args)) |
| 722 | id = res["id"] |
| 723 | log('UUID for notarization request is "{}"'.format(id)) |
| 724 | |
| 725 | while True: |
| 726 | time.sleep(15) |
| 727 | log('Checking notarization status for "{}"'.format(id)) |
| 728 | status = notarization_status(id, notarization_username, notarization_password, notarization_team_id) |
| 729 | if status == "Accepted": |
| 730 | log('Notarization was successful') |
| 731 | break |
| 732 | elif status == "Invalid": |
| 733 | log("Notarization failed") |
| 734 | log_args = ['xcrun', 'notarytool', 'log', |
| 735 | '--apple-id', notarization_username, |
| 736 | '--password', notarization_password] |
| 737 | if notarization_team_id: |
| 738 | log_args.extend(['--team-id', notarization_team_id]) |
| 739 | log_args.append(id) |
| 740 | log(run.command(log_args)) |
| 741 | sys.exit(1) |
| 742 | else: |
| 743 | log("Notarization status is {}".format(status)) |
| 744 | |
| 745 | # staple approval |
| 746 | log('Stapling notarization approval to application') |
| 747 | run.command([ |
| 748 | 'xcrun', |
| 749 | 'stapler', |
| 750 | 'staple', |
| 751 | app |
| 752 | ]) |
| 753 | |
| 754 | def notarize_dmg(app, options): |
| 755 | username = options.notarization_username |
no test coverage detected