Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def make_package(args):
sys.exit(1)

assets_dir = "src/main/assets"
res_dir = "src/main/res"

# Delete the old assets.
shutil.rmtree(assets_dir, ignore_errors=True)
Expand Down Expand Up @@ -307,6 +308,14 @@ def make_package(args):
else:
shutil.copytree(realpath(asset_src), join(assets_dir, asset_dest))

for res in args.resources:
res_src, res_dest = res.split(":")
if isfile(realpath(res_src)):
ensure_dir(dirname(join(res_dir, res_dest)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is obviously redundant with the assets copying logic just above, and could be factorized if needed

shutil.copy(realpath(res_src), join(res_dir, res_dest))
else:
shutil.copytree(realpath(res_src), join(res_dir, res_dest))

if args.private or args.launcher:
make_tar(
join(assets_dir, 'private.mp3'), tar_dirs, args.ignore_path,
Expand All @@ -319,7 +328,6 @@ def make_package(args):
shutil.rmtree(env_vars_tarpath)

# Prepare some variables for templating process
res_dir = "src/main/res"
default_icon = 'templates/kivy-icon.png'
default_presplash = 'templates/kivy-presplash.jpg'
shutil.copy(
Expand Down Expand Up @@ -626,6 +634,10 @@ def parse_args_and_make_package(args=None):
help='Custom key=value to add in application metadata')
ap.add_argument('--uses-library', dest='android_used_libs', action='append', default=[],
help='Used shared libraries included using <uses-library> tag in AndroidManifest.xml')
ap.add_argument('--resource', dest='resources',
action="append", default=[],
metavar="/path/to/res/source:dest",
help='Put this in the resources folder at /dest')
ap.add_argument('--asset', dest='assets',
action="append", default=[],
metavar="/path/to/source:dest",
Expand Down