From fdfff956d23b903ee2a696d97964f7f923d1ef71 Mon Sep 17 00:00:00 2001 From: joshvisionalgo <71997319+joshvisionalgo@users.noreply.github.com> Date: Fri, 1 Sep 2023 15:15:12 -0500 Subject: [PATCH] Wrapped --codesign-identity & --add-binary for flet pack (#1789) Wrapping --codesign-identity & --add-binary for flet pack allows end to end code signing on macOS. This avoids having to use pyinstaller directly which leads to app naming issues. --- .../flet/src/flet/cli/commands/pack.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sdk/python/packages/flet/src/flet/cli/commands/pack.py b/sdk/python/packages/flet/src/flet/cli/commands/pack.py index b8bb30caf..02c318588 100644 --- a/sdk/python/packages/flet/src/flet/cli/commands/pack.py +++ b/sdk/python/packages/flet/src/flet/cli/commands/pack.py @@ -48,6 +48,13 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None: nargs="*", help="additional non-binary files or folders to be added to the executable", ) + parser.add_argument( + "--add-binary", + dest="add_binary", + action="append", + nargs="*", + help="additional binary files to be added to the executable", + ) parser.add_argument( "--hidden-import", dest="hidden_import", @@ -85,6 +92,11 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None: dest="copyright", help="executable (Windows) or bundle (macOS) copyright", ) + parser.add_argument( + "--codesign-identity", + dest="codesign_identity", + help="Code signing identity (macOS)", + ) parser.add_argument( "--bundle-id", dest="bundle_id", @@ -117,10 +129,16 @@ def handle(self, options: argparse.Namespace) -> None: for add_data_arr in options.add_data: for add_data_item in add_data_arr: pyi_args.extend(["--add-data", add_data_item]) + if options.add_binary: + for add_binary_arr in options.add_binary: + for add_binary_item in add_binary_arr: + pyi_args.extend(["--add-binary", add_binary_item]) if options.hidden_import: for hidden_import_arr in options.hidden_import: for hidden_import_item in hidden_import_arr: pyi_args.extend(["--hidden-import", hidden_import_item]) + if options.codesign_identity: + pyi_args.extend(["--codesign-identity", options.codesign_identity]) if options.bundle_id: pyi_args.extend(["--osx-bundle-identifier", options.bundle_id]) if options.onedir: