@@ -87,11 +87,6 @@ def get_bootstrap_name():
87
87
join (curdir , 'templates' )))
88
88
89
89
90
- def try_unlink (fn ):
91
- if exists (fn ):
92
- os .unlink (fn )
93
-
94
-
95
90
def ensure_dir (path ):
96
91
if not exists (path ):
97
92
makedirs (path )
@@ -239,8 +234,7 @@ def make_package(args):
239
234
assets_dir = "src/main/assets"
240
235
241
236
# Delete the old assets.
242
- try_unlink (join (assets_dir , 'public.mp3' ))
243
- try_unlink (join (assets_dir , 'private.mp3' ))
237
+ shutil .rmtree (assets_dir , ignore_errors = True )
244
238
ensure_dir (assets_dir )
245
239
246
240
# Add extra environment variable file into tar-able directory:
@@ -304,6 +298,15 @@ def make_package(args):
304
298
tar_dirs .append (python_bundle_dir )
305
299
if get_bootstrap_name () == "webview" :
306
300
tar_dirs .append ('webview_includes' )
301
+
302
+ for asset in args .assets :
303
+ asset_src , asset_dest = asset .split (":" )
304
+ if isfile (realpath (asset_src )):
305
+ ensure_dir (dirname (join (assets_dir , asset_dest )))
306
+ shutil .copy (realpath (asset_src ), join (assets_dir , asset_dest ))
307
+ else :
308
+ shutil .copytree (realpath (asset_src ), join (assets_dir , asset_dest ))
309
+
307
310
if args .private or args .launcher :
308
311
make_tar (
309
312
join (assets_dir , 'private.mp3' ), tar_dirs , args .ignore_path ,
@@ -602,6 +605,10 @@ def parse_args_and_make_package(args=None):
602
605
help = 'Custom key=value to add in application metadata' )
603
606
ap .add_argument ('--uses-library' , dest = 'android_used_libs' , action = 'append' , default = [],
604
607
help = 'Used shared libraries included using <uses-library> tag in AndroidManifest.xml' )
608
+ ap .add_argument ('--asset' , dest = 'assets' ,
609
+ action = "append" , default = [],
610
+ metavar = "/path/to/source:dest" ,
611
+ help = 'Put this in the assets folder at assets/dest' )
605
612
ap .add_argument ('--icon' , dest = 'icon' ,
606
613
help = ('A png file to use as the icon for '
607
614
'the application.' ))
0 commit comments