MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_pip

Function get_pip

src/lib.rs:126–143  ·  view source on GitHub ↗
(scope: Scope, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

124}
125
126fn 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
145fn install_pip(installer: InstallPipMode, scope: Scope, vm: &VirtualMachine) -> PyResult<()> {
146 if !cfg!(feature = "ssl") {

Callers 1

install_pipFunction · 0.85

Calls 7

run_code_objMethod · 0.80
downcastMethod · 0.80
run_stringMethod · 0.80
expect_strMethod · 0.80
new_codeMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected