@@ -111,7 +111,7 @@ def run(command, *, host=None, env=None, log=True, **kwargs):
111111
112112def build_python_path ():
113113 """The path to the build Python binary."""
114- build_dir = subdir ("build" , "build" )
114+ build_dir = subdir ("build" )
115115 binary = build_dir / "python"
116116 if not binary .is_file ():
117117 binary = binary .with_suffix (".exe" )
@@ -125,7 +125,7 @@ def build_python_path():
125125def configure_build_python (context ):
126126 if context .clean :
127127 clean ("build" )
128- os .chdir (subdir ("build" , "build" , create = True ))
128+ os .chdir (subdir ("build" , create = True ))
129129
130130 command = [relpath (CHECKOUT / "configure" )]
131131 if context .args :
@@ -134,7 +134,7 @@ def configure_build_python(context):
134134
135135
136136def make_build_python (context ):
137- os .chdir (subdir ("build" , "build" ))
137+ os .chdir (subdir ("build" ))
138138 run (["make" , "-j" , str (os .cpu_count ())])
139139
140140
@@ -158,14 +158,14 @@ def configure_host_python(context):
158158 if context .clean :
159159 clean (context .host )
160160
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 ()
163165 os .chdir (prefix_dir )
164166 unpack_deps (context .host )
165167
166- build_dir = subdir (context .host , "build" , create = True )
167- os .chdir (build_dir )
168-
168+ os .chdir (host_dir )
169169 command = [
170170 # Basic cross-compiling configuration
171171 relpath (CHECKOUT / "configure" ),
@@ -192,11 +192,12 @@ def make_host_python(context):
192192 # The CFLAGS and LDFLAGS set in android-env include the prefix dir, so
193193 # delete any previous Python installation to prevent it being used during
194194 # the build.
195- prefix_dir = subdir (context .host , "prefix" )
195+ host_dir = subdir (context .host )
196+ prefix_dir = host_dir / "prefix"
196197 for pattern in ("include/python*" , "lib/libpython*" , "lib/python*" ):
197198 delete_glob (f"{ prefix_dir } /{ pattern } " )
198199
199- os .chdir (subdir ( context . host , "build" ) )
200+ os .chdir (host_dir )
200201 run (["make" , "-j" , str (os .cpu_count ())], host = context .host )
201202 run (["make" , "install" , f"prefix={ prefix_dir } " ], host = context .host )
202203
@@ -209,10 +210,7 @@ def build_all(context):
209210
210211
211212def 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 )
216214
217215
218216def clean_all (context ):
0 commit comments