From 76cd9db6c579f3a0975c2f1900b80e5c86109af6 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: Wed, 22 Jan 2025 16:53:53 +0800 Subject: [PATCH] def PythonDetermine in setup.py (#3975) * extract python version * Update setup.py --- setup.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 184205926..8e8265749 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,14 @@ VERSION = '0.0.0' COMMITID = 'none' +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 + + def determine_opencc_version(): # get gcc version gcc_version = None @@ -53,7 +61,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 +71,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":