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

Function get_interpreter_version

python3-sys/build.rs:238–247  ·  view source on GitHub ↗

Parse string as interpreter version.

(line: &str)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected