@@ -508,12 +508,20 @@ def make_package(args):
508508 url_scheme = 'kivy'
509509
510510 # Copy backup rules file if specified and update the argument
511+ res_xml_dir = join (res_dir , 'xml' )
511512 if args .backup_rules :
512- res_xml_dir = join (res_dir , 'xml' )
513513 ensure_dir (res_xml_dir )
514514 shutil .copy (join (args .private , args .backup_rules ), res_xml_dir )
515515 args .backup_rules = split (args .backup_rules )[1 ][:- 4 ]
516516
517+ # Copy res_xml files to src/main/res/xml
518+ if args .res_xmls :
519+ ensure_dir (res_xml_dir )
520+ for xmlpath in args .res_xmls :
521+ if not os .path .exists (xmlpath ):
522+ xmlpath = join (args .private , xmlpath )
523+ shutil .copy (xmlpath , res_xml_dir )
524+
517525 # Render out android manifest:
518526 manifest_path = "src/main/AndroidManifest.xml"
519527 render_args = {
@@ -803,6 +811,8 @@ def parse_args_and_make_package(args=None):
803811 'filename containing xml. The filename should be '
804812 'located relative to the python-for-android '
805813 'directory' ))
814+ ap .add_argument ('--res_xml' , dest = 'res_xmls' , action = 'append' , default = [],
815+ help = 'Add files to res/xml directory (for example device-filters)' , nargs = '+' )
806816 ap .add_argument ('--with-billing' , dest = 'billing_pubkey' ,
807817 help = 'If set, the billing service will be added (not implemented)' )
808818 ap .add_argument ('--add-source' , dest = 'extra_source_dirs' , action = 'append' ,
@@ -901,6 +911,9 @@ def _read_configuration():
901911 if args .permissions and isinstance (args .permissions [0 ], list ):
902912 args .permissions = [p for perm in args .permissions for p in perm ]
903913
914+ if args .res_xmls and isinstance (args .res_xmls [0 ], list ):
915+ args .res_xmls = [x for res in args .res_xmls for x in res ]
916+
904917 if args .try_system_python_compile :
905918 # Hardcoding python2.7 is okay for now, as python3 skips the
906919 # compilation anyway
0 commit comments