@@ -329,6 +329,24 @@ def make_package(args):
329329
330330 # Prepare some variables for templating process
331331 res_dir = "src/main/res"
332+ res_dir_initial = "src/res_initial"
333+ # make res_dir stateless
334+ if exists (res_dir_initial ):
335+ shutil .rmtree (res_dir , ignore_errors = True )
336+ shutil .copytree (res_dir_initial , res_dir )
337+ else :
338+ shutil .copytree (res_dir , res_dir_initial )
339+
340+ # Add user resouces
341+ for resource in args .resources :
342+ resource_src , resource_dest = resource .split (":" )
343+ if isfile (realpath (resource_src )):
344+ ensure_dir (dirname (join (res_dir , resource_dest )))
345+ shutil .copy (realpath (resource_src ), join (res_dir , resource_dest ))
346+ else :
347+ shutil .copytree (realpath (resource_src ),
348+ join (res_dir , resource_dest ), dirs_exist_ok = True )
349+
332350 default_icon = 'templates/kivy-icon.png'
333351 default_presplash = 'templates/kivy-presplash.jpg'
334352 shutil .copy (
@@ -687,6 +705,10 @@ def parse_args_and_make_package(args=None):
687705 action = "append" , default = [],
688706 metavar = "/path/to/source:dest" ,
689707 help = 'Put this in the assets folder at assets/dest' )
708+ ap .add_argument ('--resource' , dest = 'resources' ,
709+ action = "append" , default = [],
710+ metavar = "/path/to/source:kind/asset" ,
711+ help = 'Put this in the res folder at res/kind' )
690712 ap .add_argument ('--icon' , dest = 'icon' ,
691713 help = ('A png file to use as the icon for '
692714 'the application.' ))
0 commit comments