@@ -1204,8 +1204,8 @@ def get_wheel_platform_tag(self, arch):
1204
1204
"x86" : "i686" ,
1205
1205
}[arch .arch ]
1206
1206
1207
- def install_wheel (self , arch , built_wheels ):
1208
- _wheel = built_wheels [0 ]
1207
+ def install_wheel (self , arch , pattern ):
1208
+ _wheel = [ realpath ( whl ) for whl in glob . glob ( pattern )] [0 ]
1209
1209
built_wheel_dir = dirname (_wheel )
1210
1210
# Fix wheel platform tag
1211
1211
wheel_tag = wheel_tags (
@@ -1247,13 +1247,11 @@ def build_arch(self, arch):
1247
1247
"builddir={}" .format (sub_build_dir ),
1248
1248
] + self .extra_build_args
1249
1249
1250
- built_wheels = []
1251
1250
with current_directory (build_dir ):
1252
1251
shprint (
1253
1252
sh .Command (self .ctx .python_recipe .python_exe ), * build_args , _env = env
1254
1253
)
1255
- built_wheels = [realpath (whl ) for whl in glob .glob ("dist/*.whl" )]
1256
- self .install_wheel (arch , built_wheels )
1254
+ self .install_wheel (arch , join (build_dir , "dist" , "*.whl" ))
1257
1255
1258
1256
1259
1257
class MesonRecipe (PyProjectRecipe ):
@@ -1355,6 +1353,8 @@ class RustCompiledComponentsRecipe(PyProjectRecipe):
1355
1353
"x86_64" : "x86_64-linux-android" ,
1356
1354
"x86" : "i686-linux-android" ,
1357
1355
}
1356
+ # Rust toolchain to be used for building
1357
+ toolchain = "stable"
1358
1358
1359
1359
call_hostpython_via_targetpython = False
1360
1360
@@ -1367,6 +1367,7 @@ def get_recipe_env(self, arch, **kwargs):
1367
1367
build_target .upper ().replace ("-" , "_" )
1368
1368
)
1369
1369
env ["CARGO_BUILD_TARGET" ] = build_target
1370
+ env ["TARGET" ] = build_target
1370
1371
env [cargo_linker_name ] = join (
1371
1372
self .ctx .ndk .llvm_prebuilt_dir ,
1372
1373
"bin" ,
@@ -1388,10 +1389,6 @@ def get_recipe_env(self, arch, **kwargs):
1388
1389
realpython_dir , "android-build" , "build" ,
1389
1390
"lib.linux-*-{}/" .format (self .python_major_minor_version ),
1390
1391
))[0 ])
1391
-
1392
- info_main ("Ensuring rust build toolchain" )
1393
- shprint (sh .rustup , "target" , "add" , build_target )
1394
-
1395
1392
# Add host python to PATH
1396
1393
env ["PATH" ] = ("{hostpython_dir}:{old_path}" ).format (
1397
1394
hostpython_dir = Recipe .get_recipe (
@@ -1401,17 +1398,24 @@ def get_recipe_env(self, arch, **kwargs):
1401
1398
)
1402
1399
return env
1403
1400
1401
+ def ensure_rust_toolchain (self , arch ):
1402
+ info_main ("Ensuring rust build toolchain : {}" .format (self .toolchain ))
1403
+ shprint (sh .rustup , "toolchain" , "install" , self .toolchain )
1404
+ shprint (sh .rustup , "target" , "add" , "--toolchain" , self .toolchain , self .RUST_ARCH_CODES [arch .arch ])
1405
+ shprint (sh .rustup , "default" , self .toolchain )
1406
+
1404
1407
def check_host_deps (self ):
1405
1408
if not hasattr (sh , "rustup" ):
1406
1409
error (
1407
- "`rustup` was not found on host system."
1410
+ "\n `rustup` was not found on host system."
1408
1411
"Please install it using :"
1409
1412
"\n `curl https://sh.rustup.rs -sSf | sh`\n "
1410
1413
)
1411
1414
exit (1 )
1412
1415
1413
1416
def build_arch (self , arch ):
1414
1417
self .check_host_deps ()
1418
+ self .ensure_rust_toolchain (arch )
1415
1419
super ().build_arch (arch )
1416
1420
1417
1421
0 commit comments