(scope: Scope, vm: &VirtualMachine)
| 124 | } |
| 125 | |
| 126 | fn get_pip(scope: Scope, vm: &VirtualMachine) -> PyResult<()> { |
| 127 | let get_getpip = rustpython_vm::py_compile!( |
| 128 | source = r#"\ |
| 129 | __import__("io").TextIOWrapper( |
| 130 | __import__("urllib.request").request.urlopen("https://bootstrap.pypa.io/get-pip.py") |
| 131 | ).read() |
| 132 | "#, |
| 133 | mode = "eval" |
| 134 | ); |
| 135 | eprintln!("downloading get-pip.py..."); |
| 136 | let getpip_code = vm.run_code_obj(vm.ctx.new_code(get_getpip), vm.new_scope_with_builtins())?; |
| 137 | let getpip_code: rustpython_vm::builtins::PyStrRef = getpip_code |
| 138 | .downcast() |
| 139 | .expect("TextIOWrapper.read() should return str"); |
| 140 | eprintln!("running get-pip.py..."); |
| 141 | vm.run_string(scope, getpip_code.expect_str(), "get-pip.py".to_owned())?; |
| 142 | Ok(()) |
| 143 | } |
| 144 | |
| 145 | fn install_pip(installer: InstallPipMode, scope: Scope, vm: &VirtualMachine) -> PyResult<()> { |
| 146 | if !cfg!(feature = "ssl") { |
no test coverage detected