Skip to content

Commit 76cd9db

Browse files
authored
def PythonDetermine in setup.py (#3975)
* extract python version * Update setup.py
1 parent 85de840 commit 76cd9db

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
COMMITID = 'none'
3333

3434

35+
def determine_python_version():
36+
"""
37+
Determine the current python version. The function return a string such as '3.7'.
38+
"""
39+
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
40+
return python_version
41+
42+
3543
def determine_opencc_version():
3644
# get gcc version
3745
gcc_version = None
@@ -53,7 +61,7 @@ def determine_opencc_version():
5361

5462
def determine_scipy_version():
5563
# get python version
56-
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
64+
python_version = determine_python_version()
5765

5866
# determine scipy version
5967
if python_version == "3.8":
@@ -63,7 +71,7 @@ def determine_scipy_version():
6371

6472
def determine_matplotlib_version():
6573
# get python version
66-
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
74+
python_version = determine_python_version()
6775

6876
# determine matplotlib version
6977
if python_version == "3.8" or python_version == "3.9":

0 commit comments

Comments
 (0)