@@ -22,8 +22,6 @@ use crate::{
22
22
const PIP_HOME : & str = "/tmp/pip-install" ;
23
23
const PYTHON_PATH : & str = PIP_HOME ;
24
24
25
- const PIP_MIN_PYTHON_VERSION : ( u8 , u8 , u8 ) = ( 3 , 6 , 0 ) ;
26
-
27
25
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
28
26
pub struct PipConfig {
29
27
pub find_links : Vec < String > ,
@@ -200,19 +198,19 @@ pub fn bootstrap(ctx: &mut Context, ver: u8) -> Result<(), String> {
200
198
) ;
201
199
args. extend_from_slice ( & ctx. pip_settings . get_pip_args ) ;
202
200
let py_ver = python_version ( ctx, ver) ?;
203
- let _get_pip_url;
204
- let get_pip_url = if py_ver < PIP_MIN_PYTHON_VERSION {
205
- _get_pip_url = format ! ( "https://bootstrap.pypa.io/pip/{}.{}/get-pip.py" , py_ver. 0 , py_ver. 1 ) ;
206
- & _get_pip_url
207
- } else {
208
- "https://bootstrap.pypa.io/get-pip.py"
201
+ let get_pip_url = format ! ( "https://bootstrap.pypa.io/pip/{}.{}/get-pip.py" , py_ver. 0 , py_ver. 1 ) ;
202
+ // TODO: Structured downloading file error
203
+ let pip_inst = match download:: download_file (
204
+ & mut ctx. capsule , & [ get_pip_url] , None , false
205
+ ) {
206
+ Ok ( get_pip_path) => get_pip_path,
207
+ Err ( _) => {
208
+ let get_pip_default_url = "https://bootstrap.pypa.io/get-pip.py" ;
209
+ download:: download_file (
210
+ & mut ctx. capsule , & [ get_pip_default_url] , None , false
211
+ ) ?
212
+ }
209
213
} ;
210
- let pip_inst = download:: download_file (
211
- & mut ctx. capsule ,
212
- & [ get_pip_url] ,
213
- None ,
214
- false
215
- ) ?;
216
214
copy ( & pip_inst, & Path :: new ( "/vagga/root/tmp/get-pip.py" ) )
217
215
. map_err ( |e| format ! ( "Error copying pip: {}" , e) ) ?;
218
216
run_command_at_env ( ctx, & args, & Path :: new ( "/work" ) , & [ ] )
0 commit comments