Upgrade p4a #19
1 changed files with 54 additions and 49 deletions
|
@ -12,7 +12,7 @@ EXCLUDE_EXTS = (".py", ".pyc", ".so.o", ".so.a", ".so.libs", ".pyx")
|
||||||
class LbryBootstrap(Bootstrap):
|
class LbryBootstrap(Bootstrap):
|
||||||
name = 'lbry'
|
name = 'lbry'
|
||||||
|
|
||||||
recipe_depends = ['genericndkbuild', ('python2', 'python3')]
|
recipe_depends = ['genericndkbuild']
|
||||||
|
|
||||||
def assemble_distribution(self):
|
def assemble_distribution(self):
|
||||||
info_main("# Creating Android project ({})".format(self.name))
|
info_main("# Creating Android project ({})".format(self.name))
|
||||||
|
@ -38,64 +38,69 @@ class LbryBootstrap(Bootstrap):
|
||||||
with current_directory(self.dist_dir):
|
with current_directory(self.dist_dir):
|
||||||
info("Copying Python distribution")
|
info("Copying Python distribution")
|
||||||
|
|
||||||
if not exists("private"):
|
# if not exists("private"):
|
||||||
ensure_dir("private")
|
# ensure_dir("private")
|
||||||
|
|
||||||
hostpython = sh.Command(self.ctx.hostpython)
|
# gethostpython?
|
||||||
|
# hostpython = sh.Command(self.ctx.hostpython)
|
||||||
# if not from_crystax:
|
# if not from_crystax:
|
||||||
try:
|
# try:
|
||||||
shprint(hostpython, '-OO', '-m', 'compileall',
|
# shprint(hostpython, '-OO', '-m', 'compileall',
|
||||||
python_install_dir,
|
# python_install_dir,
|
||||||
_tail=10, _filterout="^Listing")
|
# _tail=10, _filterout="^Listing")
|
||||||
except sh.ErrorReturnCode:
|
# except sh.ErrorReturnCode:
|
||||||
pass
|
# pass
|
||||||
if not exists('python-install'):
|
# if not exists('python-install'):
|
||||||
shprint(
|
# shprint(
|
||||||
sh.cp, '-a', python_install_dir, './python-install')
|
# sh.cp, '-a', python_install_dir, './python-install')
|
||||||
|
|
||||||
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
|
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
|
||||||
self.distribute_javaclasses(self.ctx.javaclass_dir,
|
self.distribute_javaclasses(self.ctx.javaclass_dir,
|
||||||
dest_dir=join("src", "main", "java"))
|
dest_dir=join("src", "main", "java"))
|
||||||
|
|
||||||
|
python_bundle_dir = join(f'_python_bundle__{arch.arch}', '_python_bundle')
|
||||||
|
ensure_dir(python_bundle_dir)
|
||||||
|
site_packages_dir = self.ctx.python_recipe.create_python_bundle(
|
||||||
|
join(self.dist_dir, python_bundle_dir), arch)
|
||||||
|
|
||||||
# if not from_crystax:
|
# if not from_crystax:
|
||||||
info("Filling private directory")
|
# info("Filling private directory")
|
||||||
if not exists(join("private", "lib")):
|
# if not exists(join("private", "lib")):
|
||||||
info("private/lib does not exist, making")
|
# info("private/lib does not exist, making")
|
||||||
shprint(sh.cp, "-a",
|
# shprint(sh.cp, "-a",
|
||||||
join("python-install", "lib"), "private")
|
# join("python-install", "lib"), "private")
|
||||||
shprint(sh.mkdir, "-p",
|
# shprint(sh.mkdir, "-p",
|
||||||
join("private", "include", "python2.7"))
|
# join("private", "include", "python2.7"))
|
||||||
|
|
||||||
libpymodules_fn = join("libs", arch.arch, "libpymodules.so")
|
# libpymodules_fn = join("libs", arch.arch, "libpymodules.so")
|
||||||
if exists(libpymodules_fn):
|
# if exists(libpymodules_fn):
|
||||||
shprint(sh.mv, libpymodules_fn, 'private/')
|
# shprint(sh.mv, libpymodules_fn, 'private/')
|
||||||
shprint(sh.cp,
|
# shprint(sh.cp,
|
||||||
join('python-install', 'include',
|
# join('python-install', 'include',
|
||||||
'python2.7', 'pyconfig.h'),
|
# 'python2.7', 'pyconfig.h'),
|
||||||
join('private', 'include', 'python2.7/'))
|
# join('private', 'include', 'python2.7/'))
|
||||||
|
#
|
||||||
|
# info('Removing some unwanted files')
|
||||||
|
# shprint(sh.rm, '-f', join('private', 'lib', 'libpython2.7.so'))
|
||||||
|
# shprint(sh.rm, '-rf', join('private', 'lib', 'pkgconfig'))
|
||||||
|
|
||||||
info('Removing some unwanted files')
|
# libdir = join(self.dist_dir, 'private', 'lib', 'python2.7')
|
||||||
shprint(sh.rm, '-f', join('private', 'lib', 'libpython2.7.so'))
|
# with current_directory(libdir):
|
||||||
shprint(sh.rm, '-rf', join('private', 'lib', 'pkgconfig'))
|
# removes = []
|
||||||
|
# for dirname, root, filenames in walk("."):
|
||||||
libdir = join(self.dist_dir, 'private', 'lib', 'python2.7')
|
# for filename in filenames:
|
||||||
site_packages_dir = join(libdir, 'site-packages')
|
# for suffix in EXCLUDE_EXTS:
|
||||||
with current_directory(libdir):
|
# if filename.endswith(suffix):
|
||||||
removes = []
|
# removes.append(filename)
|
||||||
for dirname, root, filenames in walk("."):
|
# shprint(sh.rm, '-f', *removes)
|
||||||
for filename in filenames:
|
#
|
||||||
for suffix in EXCLUDE_EXTS:
|
# info('Deleting some other stuff not used on android')
|
||||||
if filename.endswith(suffix):
|
# # To quote the original distribute.sh, 'well...'
|
||||||
removes.append(filename)
|
# shprint(sh.rm, '-rf', 'lib2to3')
|
||||||
shprint(sh.rm, '-f', *removes)
|
# shprint(sh.rm, '-rf', 'idlelib')
|
||||||
|
# for filename in glob.glob('config/libpython*.a'):
|
||||||
info('Deleting some other stuff not used on android')
|
# shprint(sh.rm, '-f', filename)
|
||||||
# To quote the original distribute.sh, 'well...'
|
# shprint(sh.rm, '-rf', 'config/python.o')
|
||||||
shprint(sh.rm, '-rf', 'lib2to3')
|
|
||||||
shprint(sh.rm, '-rf', 'idlelib')
|
|
||||||
for filename in glob.glob('config/libpython*.a'):
|
|
||||||
shprint(sh.rm, '-f', filename)
|
|
||||||
shprint(sh.rm, '-rf', 'config/python.o')
|
|
||||||
|
|
||||||
# else: # Python *is* loaded from crystax
|
# else: # Python *is* loaded from crystax
|
||||||
# ndk_dir = self.ctx.ndk_dir
|
# ndk_dir = self.ctx.ndk_dir
|
||||||
|
|
Loading…
Reference in a new issue