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

Method get_env

pythonforandroid/archs.py:109–232  ·  view source on GitHub ↗
(self, with_flags_in_cc=True)

Source from the content-addressed store, hash-verified

107 return join(self.ctx.ndk.llvm_bin_dir, compiler)
108
109 def get_env(self, with_flags_in_cc=True):
110 env = {}
111
112 # HOME: User's home directory
113 #
114 # Many tools including p4a store outputs in the user's home
115 # directory. This is found from the HOME environment variable
116 # and falls back to the system account database. Setting HOME
117 # can be used to globally divert these tools to use a different
118 # path. Furthermore, in containerized environments the user may
119 # not exist in the account database, so if HOME isn't set than
120 # these tools will fail.
121 if 'HOME' in environ:
122 env['HOME'] = environ['HOME']
123
124 # CFLAGS/CXXFLAGS: the processor flags
125 env['CFLAGS'] = ' '.join(self.common_cflags).format(target=self.target)
126 if self.arch_cflags:
127 # each architecture may have has his own CFLAGS
128 env['CFLAGS'] += ' ' + ' '.join(self.arch_cflags)
129 env['CXXFLAGS'] = env['CFLAGS']
130
131 # CPPFLAGS (for macros and includes)
132 env['CPPFLAGS'] = ' '.join(self.common_cppflags).format(
133 ctx=self.ctx,
134 command_prefix=self.command_prefix,
135 python_includes=join(Recipe.get_recipe("python3", self.ctx).include_root(self.arch))
136 )
137
138 # LDFLAGS: Link the extra global link paths first before anything else
139 # (such that overriding system libraries with them is possible)
140 env['LDFLAGS'] = (
141 ' '
142 + " ".join(
143 [
144 "-L"
145 + link_path
146 for link_path in self.extra_global_link_paths
147 ]
148 )
149 + ' ' + ' '.join(self.common_ldflags).format(
150 ctx_libs_dir=self.ctx.get_libs_dir(self.arch)
151 )
152 )
153
154 # LDLIBS: Library flags or names given to compilers when they are
155 # supposed to invoke the linker.
156 env['LDLIBS'] = ' '.join(self.common_ldlibs)
157
158 # CCACHE
159 ccache = ''
160 if self.ctx.ccache and bool(int(environ.get('USE_CCACHE', '1'))):
161 # print('ccache found, will optimize builds')
162 ccache = self.ctx.ccache + ' '
163 env['USE_CCACHE'] = '1'
164 env['NDK_CCACHE'] = self.ctx.ccache
165 env.update(
166 {k: v for k, v in environ.items() if k.startswith('CCACHE_')}

Callers 10

strip_librariesMethod · 0.80
biglinkFunction · 0.80
get_recipe_envMethod · 0.80
get_recipe_envMethod · 0.80
build_archMethod · 0.80
test_arch_armMethod · 0.80
test_arch_armv7aMethod · 0.80
test_arch_x86Method · 0.80
test_arch_x86_64Method · 0.80
test_arch_aarch_64Method · 0.80

Calls 6

formatMethod · 0.80
get_recipeMethod · 0.80
get_libs_dirMethod · 0.80
include_rootMethod · 0.45
get_build_dirMethod · 0.45

Tested by 5

test_arch_armMethod · 0.64
test_arch_armv7aMethod · 0.64
test_arch_x86Method · 0.64
test_arch_x86_64Method · 0.64
test_arch_aarch_64Method · 0.64