@@ -233,54 +233,64 @@ impl PythonPlugin {
233233 ctx : & InstallContext ,
234234 tv : & mut ToolVersion ,
235235 ) -> eyre:: Result < ( ) > {
236- let precompiled_versions = self . fetch_precompiled_remote_versions ( ) . await ?;
237- let precompile_info = precompiled_versions
238- . iter ( )
239- . rev ( )
240- . find ( |( v, _, _) | & tv. version == v) ;
241- let ( tag, filename) = match precompile_info {
242- Some ( ( _, tag, filename) ) => ( tag, filename) ,
243- None => {
244- if cfg ! ( windows) || Settings :: get ( ) . python . compile == Some ( false ) {
245- if !cfg ! ( windows) {
246- hint ! (
247- "python_compile" ,
248- "To compile python from source, run" ,
249- "mise settings python.compile=1"
236+ let platform_key = self . get_platform_key ( ) ;
237+ let url = if let Some ( url) = tv
238+ . lock_platforms
239+ . get ( & platform_key)
240+ . and_then ( |pi| pi. url . clone ( ) )
241+ {
242+ debug ! ( "using lockfile URL for platform {platform_key}: {url}" ) ;
243+ url
244+ } else {
245+ let precompiled_versions = self . fetch_precompiled_remote_versions ( ) . await ?;
246+ let precompile_info = precompiled_versions
247+ . iter ( )
248+ . rev ( )
249+ . find ( |( v, _, _) | & tv. version == v) ;
250+ let ( tag, filename) = match precompile_info {
251+ Some ( ( _, tag, filename) ) => ( tag, filename) ,
252+ None => {
253+ if cfg ! ( windows) || Settings :: get ( ) . python . compile == Some ( false ) {
254+ if !cfg ! ( windows) {
255+ hint ! (
256+ "python_compile" ,
257+ "To compile python from source, run" ,
258+ "mise settings python.compile=1"
259+ ) ;
260+ }
261+ let platform = python_precompiled_platform ( ) ;
262+ bail ! ( "no precompiled python found for {tv} on {platform}" ) ;
263+ }
264+ let available = precompiled_versions. iter ( ) . map ( |( v, _, _) | v) . collect_vec ( ) ;
265+ if available. is_empty ( ) {
266+ debug ! ( "no precompiled python found for {}" , tv. version) ;
267+ } else {
268+ warn ! (
269+ "no precompiled python found for {}, force mise to use a precompiled version with `mise settings set python.compile false`" ,
270+ tv. version
250271 ) ;
251272 }
252- let platform = python_precompiled_platform ( ) ;
253- bail ! ( "no precompiled python found for {tv} on {platform}" ) ;
254- }
255- let available = precompiled_versions. iter ( ) . map ( |( v, _, _) | v) . collect_vec ( ) ;
256- if available. is_empty ( ) {
257- debug ! ( "no precompiled python found for {}" , tv. version) ;
258- } else {
259- warn ! (
260- "no precompiled python found for {}, force mise to use a precompiled version with `mise settings set python.compile false`" ,
261- tv. version
273+ trace ! (
274+ "available precompiled versions: {}" ,
275+ available. into_iter( ) . join( ", " )
262276 ) ;
277+ return self . install_compiled ( ctx, tv) . await ;
263278 }
264- trace ! (
265- "available precompiled versions: {}" ,
266- available. into_iter( ) . join( ", " )
279+ } ;
280+
281+ if cfg ! ( unix) {
282+ hint ! (
283+ "python_precompiled" ,
284+ "installing precompiled python from astral-sh/python-build-standalone\n \
285+ if you experience issues with this python (e.g.: running poetry), switch to python-build by running",
286+ "mise settings python.compile=1"
267287 ) ;
268- return self . install_compiled ( ctx, tv) . await ;
269288 }
270- } ;
271289
272- if cfg ! ( unix) {
273- hint ! (
274- "python_precompiled" ,
275- "installing precompiled python from astral-sh/python-build-standalone\n \
276- if you experience issues with this python (e.g.: running poetry), switch to python-build by running",
277- "mise settings python.compile=1"
278- ) ;
279- }
280-
281- let url = format ! (
282- "https://github.com/astral-sh/python-build-standalone/releases/download/{tag}/{filename}"
283- ) ;
290+ format ! (
291+ "https://github.com/astral-sh/python-build-standalone/releases/download/{tag}/{filename}"
292+ )
293+ } ;
284294 let filename = url. split ( '/' ) . next_back ( ) . unwrap ( ) ;
285295 let install = tv. install_path ( ) ;
286296 let download = tv. download_path ( ) ;
@@ -291,7 +301,6 @@ impl PythonPlugin {
291301 . await ?;
292302
293303 // Record the URL in lock_platforms so verify_checksum can find it
294- let platform_key = self . get_platform_key ( ) ;
295304 tv. lock_platforms
296305 . entry ( platform_key. clone ( ) )
297306 . or_default ( )
0 commit comments