Skip to content

Commit 8350dfd

Browse files
committed
Add option for copying arbitratry xml files to src/main/res/xml without touching manifest
1 parent 690dd18 commit 8350dfd

File tree

1 file changed

+11
-1
lines changed
  • pythonforandroid/bootstraps/common/build

1 file changed

+11
-1
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,20 @@ def make_package(args):
471471
url_scheme = 'kivy'
472472

473473
# Copy backup rules file if specified and update the argument
474+
res_xml_dir = join(res_dir, 'xml')
474475
if args.backup_rules:
475-
res_xml_dir = join(res_dir, 'xml')
476476
ensure_dir(res_xml_dir)
477477
shutil.copy(join(args.private, args.backup_rules), res_xml_dir)
478478
args.backup_rules = split(args.backup_rules)[1][:-4]
479479

480+
# Copy res_xml files to src/main/res/xml
481+
if args.res_xmls:
482+
ensure_dir(res_xml_dir)
483+
for xmlpath in args.res_xmls:
484+
if not os.path.exists(xmlpath):
485+
xmlpath = join(args.private, xmlpath)
486+
shutil.copy(xmlpath, res_xml_dir)
487+
480488
# Render out android manifest:
481489
manifest_path = "src/main/AndroidManifest.xml"
482490
render_args = {
@@ -737,6 +745,8 @@ def parse_args_and_make_package(args=None):
737745
'filename containing xml. The filename should be '
738746
'located relative to the python-for-android '
739747
'directory'))
748+
ap.add_argument('--res_xml', dest='res_xmls', action='append', default=[],
749+
help='Add files to res/xml directory (for example device-filters)', nargs='+')
740750
ap.add_argument('--with-billing', dest='billing_pubkey',
741751
help='If set, the billing service will be added (not implemented)')
742752
ap.add_argument('--add-source', dest='extra_source_dirs', action='append',

0 commit comments

Comments
 (0)