-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy path__init__.py
More file actions
53 lines (40 loc) · 2.03 KB
/
Copy path__init__.py
File metadata and controls
53 lines (40 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sh
from os.path import join
from pythonforandroid.toolchain import (
Bootstrap, current_directory, info, info_main, shprint)
from pythonforandroid.util import ensure_dir, rmdir
class QtBootstrap(Bootstrap):
name = 'qt'
recipe_depends = ['python3', 'genericndkbuild', 'PySide6', 'shiboken6']
# this is needed because the recipes PySide6 and shiboken6 resides in the PySide Qt repository
# - https://code.qt.io/cgit/pyside/pyside-setup.git/
# Without this some tests will error because it cannot find the recipes within pythonforandroid
# repository
can_be_chosen_automatically = False
def assemble_distribution(self):
info_main("# Creating Android project using Qt bootstrap")
rmdir(self.dist_dir)
info("Copying gradle build")
shprint(sh.cp, '-r', self.build_dir, self.dist_dir)
with current_directory(self.dist_dir):
with open('local.properties', 'w') as fileh:
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
arch = self.ctx.archs[0]
if len(self.ctx.archs) > 1:
raise ValueError("Trying to build for more than one arch. Qt bootstrap cannot handle that yet")
info(f"Bootstrap running with arch {arch}")
with current_directory(self.dist_dir):
info("Copying Python distribution")
self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
self.distribute_aars(arch)
self.distribute_javaclasses(self.ctx.javaclass_dir,
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 self.ctx.with_debug_symbols:
self.strip_libraries(arch)
self.fry_eggs(site_packages_dir)
super().assemble_distribution()
bootstrap = QtBootstrap()