From 5adae77e393fee0b537a8c93302d62b744753729 Mon Sep 17 00:00:00 2001 From: LYK Date: Mon, 6 Mar 2023 23:01:06 +0900 Subject: [PATCH] Add sys.winver --- vm/src/stdlib/sys.rs | 7 +++++++ vm/src/version.rs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/vm/src/stdlib/sys.rs b/vm/src/stdlib/sys.rs index e202958b50..ba472f9f53 100644 --- a/vm/src/stdlib/sys.rs +++ b/vm/src/stdlib/sys.rs @@ -262,6 +262,13 @@ mod sys { version::get_version() } + #[cfg(windows)] + #[pyattr] + fn winver(_vm: &VirtualMachine) -> String { + // Note: This is Python DLL version in CPython, but we arbitrary fill it for compatibility + version::get_winver_number() + } + #[pyattr] fn _xoptions(vm: &VirtualMachine) -> PyDictRef { let ctx = &vm.ctx; diff --git a/vm/src/version.rs b/vm/src/version.rs index 8c9516b907..ec23e896b0 100644 --- a/vm/src/version.rs +++ b/vm/src/version.rs @@ -28,6 +28,10 @@ pub fn get_version_number() -> String { format!("{MAJOR}.{MINOR}.{MICRO}{RELEASELEVEL}") } +pub fn get_winver_number() -> String { + format!("{MAJOR}.{MINOR}") +} + pub fn get_compiler() -> String { format!("rustc {}", env!("RUSTC_VERSION")) }