13
13
("templates" , "./templates" ),
14
14
]
15
15
16
- if sys .platform .startswith ("win" ):
17
- added_data_options = [f"--add-data={ src } ;{ dst } " for src , dst in added_files ]
18
- else :
19
- added_data_options = [f"--add-data={ src } :{ dst } " for src , dst in added_files ]
20
-
21
16
22
17
def build_macos (
23
18
one_file : bool ,
19
+ bundle_third_party : bool ,
24
20
):
25
21
pyinstaller_options = [
26
22
"--noconfirm" ,
@@ -32,7 +28,19 @@ def build_macos(
32
28
else :
33
29
pyinstaller_options += ["--onedir" ]
34
30
35
- options = pyinstaller_options + added_data_options
31
+ if bundle_third_party :
32
+ added_binaries = [
33
+ ("/usr/local/bin/wkhtmltopdf" , "." ),
34
+ ]
35
+ added_binary_options = [
36
+ f"--add-binary={ src } :{ dst } " for src , dst in added_binaries
37
+ ]
38
+ else :
39
+ added_binary_options = []
40
+
41
+ added_data_options = [f"--add-data={ src } :{ dst } " for src , dst in added_files ]
42
+
43
+ options = pyinstaller_options + added_data_options + added_binary_options
36
44
37
45
logger .info (f"calling pyinstaller with options: { ' ' .join (options )} " )
38
46
subprocess .call (
@@ -55,6 +63,8 @@ def build_linux(
55
63
else :
56
64
pyinstaller_options += ["--onedir" ]
57
65
66
+ added_data_options = [f"--add-data={ src } :{ dst } " for src , dst in added_files ]
67
+
58
68
options = pyinstaller_options + added_data_options
59
69
60
70
logger .info (f"calling pyinstaller with options: { ' ' .join (options )} " )
@@ -79,6 +89,8 @@ def build_windows(
79
89
else :
80
90
pyinstaller_options += ["--onedir" ]
81
91
92
+ added_data_options = [f"--add-data={ src } ;{ dst } " for src , dst in added_files ]
93
+
82
94
options = pyinstaller_options + added_data_options
83
95
84
96
logger .info (f"calling pyinstaller with options: { ' ' .join (options )} " )
@@ -95,6 +107,9 @@ def main(
95
107
one_file : bool = typer .Option (
96
108
False , "--one-file" , "-f" , help = "Build a single file executable"
97
109
),
110
+ bundle_third_party : bool = typer .Option (
111
+ True , "--bundle-third-party" , "-b" , help = "Bundle third party libraries"
112
+ ),
98
113
):
99
114
if install_dir :
100
115
logger .info (f"removing app from { install_dir } " )
@@ -110,6 +125,7 @@ def main(
110
125
logger .info ("building for macOS" )
111
126
build_macos (
112
127
one_file = one_file ,
128
+ bundle_third_party = bundle_third_party ,
113
129
)
114
130
elif sys .platform .startswith ("win" ):
115
131
logger .info ("building for Windows" )
0 commit comments