MCPcopy Index your code
hub / github.com/kivy/python-for-android / Bootstrap

Class Bootstrap

pythonforandroid/bootstrap.py:72–450  ·  view source on GitHub ↗

An Android project template, containing recipe stuff for compilation and templated fields for APK info.

Source from the content-addressed store, hash-verified

70
71
72class Bootstrap:
73 '''An Android project template, containing recipe stuff for
74 compilation and templated fields for APK info.
75 '''
76 jni_subdir = '/jni'
77 ctx = None
78
79 bootstrap_dir = None
80
81 build_dir = None
82 dist_name = None
83 distribution = None
84
85 # All bootstraps should include Python in some way:
86 recipe_depends = ['python3', 'android']
87
88 can_be_chosen_automatically = True
89 '''Determines whether the bootstrap can be chosen as one that
90 satisfies user requirements. If False, it will not be returned
91 from Bootstrap.get_bootstrap_from_recipes.
92 '''
93
94 # Other things a Bootstrap might need to track (maybe separately):
95 # ndk_main.c
96 # whitelist.txt
97 # blacklist.txt
98
99 @property
100 def dist_dir(self):
101 '''The dist dir at which to place the finished distribution.'''
102 if self.distribution is None:
103 raise BuildInterruptingException(
104 'Internal error: tried to access {}.dist_dir, but {}.distribution '
105 'is None'.format(self, self))
106 return self.distribution.dist_dir
107
108 @property
109 def jni_dir(self):
110 return self.name + self.jni_subdir
111
112 def check_recipe_choices(self):
113 '''Checks what recipes are being built to see which of the alternative
114 and optional dependencies are being used,
115 and returns a list of these.'''
116 recipes = []
117 built_recipes = self.ctx.recipe_build_order or []
118 for recipe in self.recipe_depends:
119 if isinstance(recipe, (tuple, list)):
120 for alternative in recipe:
121 if alternative in built_recipes:
122 recipes.append(alternative)
123 break
124 return sorted(recipes)
125
126 def get_build_dir_name(self):
127 choices = self.check_recipe_choices()
128 dir_name = '-'.join([self.name] + choices)
129 return dir_name

Calls

no outgoing calls