Skip to content

Commit 9cb1ab6

Browse files
authored
add_resource
1 parent 3d5425c commit 9cb1ab6

File tree

1 file changed

+15
-0
lines changed
  • pythonforandroid/bootstraps/common/build

1 file changed

+15
-0
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,17 @@ def make_package(args):
340340

341341
# Prepare some variables for templating process
342342
res_dir = "src/main/res"
343+
# Add user resouces
344+
shutil.rmtree(res_dir, ignore_errors=True)
345+
ensure_dir(res_dir)
346+
for resource in args.resources:
347+
resource_src, resource_dest = resource.split(":")
348+
if isfile(realpath(resource_src)):
349+
ensure_dir(dirname(join(res_dir, resource_dest)))
350+
shutil.copy(realpath(resource_src), join(res_dir, resource_dest))
351+
else:
352+
shutil.copytree(realpath(resource_src), join(res_dir, resource_dest))
353+
343354
default_icon = 'templates/kivy-icon.png'
344355
default_presplash = 'templates/kivy-presplash.jpg'
345356
shutil.copy(
@@ -698,6 +709,10 @@ def parse_args_and_make_package(args=None):
698709
action="append", default=[],
699710
metavar="/path/to/source:dest",
700711
help='Put this in the assets folder at assets/dest')
712+
ap.add_argument('--resource', dest='resources',
713+
action="append", default=[],
714+
metavar="/path/to/source:kind/asset",
715+
help='Put this in the res folder at res/kind')
701716
ap.add_argument('--icon', dest='icon',
702717
help=('A png file to use as the icon for '
703718
'the application.'))

0 commit comments

Comments
 (0)