Skip to content

Commit 6735c6f

Browse files
authored
Merge pull request kivy#1585 from opacam/fix-slow-copy
[CORE FIX/ENHANCEMENT] Speedup copy that can be very very long (up to 2 minutes)
2 parents 715be33 + 4f11666 commit 6735c6f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pythonforandroid/python.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
'''
55

66
from os.path import dirname, exists, join
7+
from shutil import copy2
78
from os import environ
89
import glob
910
import sh
@@ -268,14 +269,17 @@ def create_python_bundle(self, dirn, arch):
268269
))
269270
module_filens = (glob.glob(join(modules_build_dir, '*.so')) +
270271
glob.glob(join(modules_build_dir, '*.py')))
272+
info("Copy {} files into the bundle".format(len(module_filens)))
271273
for filen in module_filens:
272-
shprint(sh.cp, filen, modules_dir)
274+
info(" - copy {}".format(filen))
275+
copy2(filen, modules_dir)
273276

274277
# zip up the standard library
275278
stdlib_zip = join(dirn, 'stdlib.zip')
276279
with current_directory(join(self.get_build_dir(arch.arch), 'Lib')):
277-
stdlib_filens = walk_valid_filens(
278-
'.', self.stdlib_dir_blacklist, self.stdlib_filen_blacklist)
280+
stdlib_filens = list(walk_valid_filens(
281+
'.', self.stdlib_dir_blacklist, self.stdlib_filen_blacklist))
282+
info("Zip {} files into the bundle".format(len(stdlib_filens)))
279283
shprint(sh.zip, stdlib_zip, *stdlib_filens)
280284

281285
# copy the site-packages into place
@@ -286,9 +290,11 @@ def create_python_bundle(self, dirn, arch):
286290
filens = list(walk_valid_filens(
287291
'.', self.site_packages_dir_blacklist,
288292
self.site_packages_filen_blacklist))
293+
info("Copy {} files into the site-packages".format(len(filens)))
289294
for filen in filens:
295+
info(" - copy {}".format(filen))
290296
ensure_dir(join(dirn, 'site-packages', dirname(filen)))
291-
sh.cp(filen, join(dirn, 'site-packages', filen))
297+
copy2(filen, join(dirn, 'site-packages', filen))
292298

293299
# copy the python .so files into place
294300
python_build_dir = join(self.get_build_dir(arch.arch),

0 commit comments

Comments
 (0)