@@ -87,11 +87,6 @@ def get_bootstrap_name():
8787 join (curdir , 'templates' )))
8888
8989
90- def try_unlink (fn ):
91- if exists (fn ):
92- os .unlink (fn )
93-
94-
9590def ensure_dir (path ):
9691 if not exists (path ):
9792 makedirs (path )
@@ -239,8 +234,7 @@ def make_package(args):
239234 assets_dir = "src/main/assets"
240235
241236 # 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 )
244238 ensure_dir (assets_dir )
245239
246240 # Add extra environment variable file into tar-able directory:
@@ -304,6 +298,15 @@ def make_package(args):
304298 tar_dirs .append (python_bundle_dir )
305299 if get_bootstrap_name () == "webview" :
306300 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+
307310 if args .private or args .launcher :
308311 make_tar (
309312 join (assets_dir , 'private.mp3' ), tar_dirs , args .ignore_path ,
@@ -602,6 +605,10 @@ def parse_args_and_make_package(args=None):
602605 help = 'Custom key=value to add in application metadata' )
603606 ap .add_argument ('--uses-library' , dest = 'android_used_libs' , action = 'append' , default = [],
604607 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' )
605612 ap .add_argument ('--icon' , dest = 'icon' ,
606613 help = ('A png file to use as the icon for '
607614 'the application.' ))
0 commit comments