@@ -1204,8 +1204,8 @@ def get_wheel_platform_tag(self, arch):
12041204 "x86" : "i686" ,
12051205 }[arch .arch ]
12061206
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 ]
12091209 built_wheel_dir = dirname (_wheel )
12101210 # Fix wheel platform tag
12111211 wheel_tag = wheel_tags (
@@ -1247,13 +1247,11 @@ def build_arch(self, arch):
12471247 "builddir={}" .format (sub_build_dir ),
12481248 ] + self .extra_build_args
12491249
1250- built_wheels = []
12511250 with current_directory (build_dir ):
12521251 shprint (
12531252 sh .Command (self .ctx .python_recipe .python_exe ), * build_args , _env = env
12541253 )
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" ))
12571255
12581256
12591257class MesonRecipe (PyProjectRecipe ):
@@ -1355,6 +1353,8 @@ class RustCompiledComponentsRecipe(PyProjectRecipe):
13551353 "x86_64" : "x86_64-linux-android" ,
13561354 "x86" : "i686-linux-android" ,
13571355 }
1356+ # Rust toolchain to be used for building
1357+ toolchain = "stable"
13581358
13591359 call_hostpython_via_targetpython = False
13601360
@@ -1367,6 +1367,7 @@ def get_recipe_env(self, arch, **kwargs):
13671367 build_target .upper ().replace ("-" , "_" )
13681368 )
13691369 env ["CARGO_BUILD_TARGET" ] = build_target
1370+ env ["TARGET" ] = build_target
13701371 env [cargo_linker_name ] = join (
13711372 self .ctx .ndk .llvm_prebuilt_dir ,
13721373 "bin" ,
@@ -1388,10 +1389,6 @@ def get_recipe_env(self, arch, **kwargs):
13881389 realpython_dir , "android-build" , "build" ,
13891390 "lib.linux-*-{}/" .format (self .python_major_minor_version ),
13901391 ))[0 ])
1391-
1392- info_main ("Ensuring rust build toolchain" )
1393- shprint (sh .rustup , "target" , "add" , build_target )
1394-
13951392 # Add host python to PATH
13961393 env ["PATH" ] = ("{hostpython_dir}:{old_path}" ).format (
13971394 hostpython_dir = Recipe .get_recipe (
@@ -1401,17 +1398,24 @@ def get_recipe_env(self, arch, **kwargs):
14011398 )
14021399 return env
14031400
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+
14041407 def check_host_deps (self ):
14051408 if not hasattr (sh , "rustup" ):
14061409 error (
1407- "`rustup` was not found on host system."
1410+ "\n `rustup` was not found on host system."
14081411 "Please install it using :"
14091412 "\n `curl https://sh.rustup.rs -sSf | sh`\n "
14101413 )
14111414 exit (1 )
14121415
14131416 def build_arch (self , arch ):
14141417 self .check_host_deps ()
1418+ self .ensure_rust_toolchain (arch )
14151419 super ().build_arch (arch )
14161420
14171421
0 commit comments