MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / get_interpreter_version

Function get_interpreter_version

python27-sys/build.rs:241–250  ·  view source on GitHub ↗

Parse string as interpreter version.

(line: &str)

Source from the content-addressed store, hash-verified

239
240/// Parse string as interpreter version.
241fn get_interpreter_version(line: &str) -> Result<PythonVersion, String> {
242 let version_re = Regex::new(r"\((\d+), (\d+)\)").unwrap();
243 match version_re.captures(&line) {
244 Some(cap) => Ok(PythonVersion {
245 major: cap.get(1).unwrap().as_str().parse().unwrap(),
246 minor: Some(cap.get(2).unwrap().as_str().parse().unwrap()),
247 }),
248 None => Err(format!("Unexpected response to version query {}", line)),
249 }
250}
251
252#[cfg(target_os = "windows")]
253fn get_rustc_link_lib(version: &PythonVersion, _: &str, _: bool) -> Result<String, String> {

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected