MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / get_python_version_from_env

Method get_python_version_from_env

client/tool/util/pythontool.py:54–66  ·  view source on GitHub ↗

从环境变量中获取python版本号,环境变量只支持2或3 :return: "2"|"3"

()

Source from the content-addressed store, hash-verified

52
53 @staticmethod
54 def get_python_version_from_env():
55 """
56 从环境变量中获取python版本号,环境变量只支持2或3
57 :return: <str> "2"|"3"
58 """
59 # 支持从环境变量指定python版本
60 python_version = os.environ.get('PYLINT_PYTHON_VERSION')
61 if python_version is None:
62 # 支持通过PYTHON_VERSION环境变量设置python版本
63 python_version = os.environ.get('PYTHON_VERSION')
64 if python_version not in ["2", "3"]: # 环境变量只支持2或3
65 python_version = "3"
66 return python_version
67
68 @staticmethod
69 def check_python(tool_name):

Callers 2

check_tool_usableMethod · 0.80
check_pythonMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected