@@ -111,7 +111,7 @@ def run(command, *, host=None, env=None, log=True, **kwargs):
111
111
112
112
def build_python_path ():
113
113
"""The path to the build Python binary."""
114
- build_dir = subdir ("build" , "build" )
114
+ build_dir = subdir ("build" )
115
115
binary = build_dir / "python"
116
116
if not binary .is_file ():
117
117
binary = binary .with_suffix (".exe" )
@@ -125,7 +125,7 @@ def build_python_path():
125
125
def configure_build_python (context ):
126
126
if context .clean :
127
127
clean ("build" )
128
- os .chdir (subdir ("build" ,"build" , create = True ))
128
+ os .chdir (subdir ("build" ,create = True ))
129
129
130
130
command = [relpath (CHECKOUT / "configure" )]
131
131
if context .args :
@@ -134,7 +134,7 @@ def configure_build_python(context):
134
134
135
135
136
136
def make_build_python (context ):
137
- os .chdir (subdir ("build" , "build" ))
137
+ os .chdir (subdir ("build" ))
138
138
run (["make" ,"-j" ,str (os .cpu_count ())])
139
139
140
140
@@ -158,14 +158,14 @@ def configure_host_python(context):
158
158
if context .clean :
159
159
clean (context .host )
160
160
161
- prefix_dir = subdir (context .host ,"prefix" ,create = True )
162
- if not (prefix_dir / "include" ).exists ():
161
+ host_dir = subdir (context .host ,create = True )
162
+ prefix_dir = host_dir / "prefix"
163
+ if not prefix_dir .exists ():
164
+ prefix_dir .mkdir ()
163
165
os .chdir (prefix_dir )
164
166
unpack_deps (context .host )
165
167
166
- build_dir = subdir (context .host ,"build" ,create = True )
167
- os .chdir (build_dir )
168
-
168
+ os .chdir (host_dir )
169
169
command = [
170
170
# Basic cross-compiling configuration
171
171
relpath (CHECKOUT / "configure" ),
@@ -192,11 +192,12 @@ def make_host_python(context):
192
192
# The CFLAGS and LDFLAGS set in android-env include the prefix dir, so
193
193
# delete any previous Python installation to prevent it being used during
194
194
# the build.
195
- prefix_dir = subdir (context .host ,"prefix" )
195
+ host_dir = subdir (context .host )
196
+ prefix_dir = host_dir / "prefix"
196
197
for pattern in ("include/python*" ,"lib/libpython*" ,"lib/python*" ):
197
198
delete_glob (f"{ prefix_dir } /{ pattern } " )
198
199
199
- os .chdir (subdir ( context . host , "build" ) )
200
+ os .chdir (host_dir )
200
201
run (["make" ,"-j" ,str (os .cpu_count ())],host = context .host )
201
202
run (["make" ,"install" ,f"prefix={ prefix_dir } " ],host = context .host )
202
203
@@ -209,10 +210,7 @@ def build_all(context):
209
210
210
211
211
212
def clean (host ):
212
- # Don't delete "dist", as that could be difficult to regenerate, and won't
213
- # affect future builds anyway.
214
- for name in ["build" ,"prefix" ]:
215
- delete_glob (CROSS_BUILD_DIR / host / name )
213
+ delete_glob (CROSS_BUILD_DIR / host )
216
214
217
215
218
216
def clean_all (context ):