From a22bc8c663fc075edd2ac26eadf70f15d4e412b2 Mon Sep 17 00:00:00 2001 From: liyulingyue <852433440@qq.com> Date: Fri, 17 Jan 2025 21:59:56 +0800 Subject: [PATCH 1/2] extract python version --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index fa53b5d7e8..758a22db68 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,11 @@ COMMITID = 'none' +def determine_python_version(): + python_version = f"{sys.version_info.major}.{sys.version_info.minor}" + return python_version + + def determine_opencc_version(): # get gcc version gcc_version = None @@ -53,7 +58,7 @@ def determine_opencc_version(): def determine_scipy_version(): # get python version - python_version = f"{sys.version_info.major}.{sys.version_info.minor}" + python_version = determine_python_version() # determine scipy version if python_version == "3.8": @@ -63,7 +68,7 @@ def determine_scipy_version(): def determine_matplotlib_version(): # get python version - python_version = f"{sys.version_info.major}.{sys.version_info.minor}" + python_version = determine_python_version() # determine matplotlib version if python_version == "3.8" or python_version == "3.9": From 79370fd3667bfc89fc636c6257429357d5fc489f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:30:19 +0800 Subject: [PATCH 2/2] Update setup.py --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 758a22db68..7b876bb9c4 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,9 @@ def determine_python_version(): + """ + Determine the current python version. The function return a string such as '3.7'. + """ python_version = f"{sys.version_info.major}.{sys.version_info.minor}" return python_version