从环境变量中获取python版本号,环境变量只支持2或3 :return: "2"|"3"
()
| 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): |
no test coverage detected