Skip to content

Fix: Format mono script for Python2

路志远请求将format-mono-script-for-py2合并到main-jh

What does this MR do and why?

What

调整 mono 脚本的格式,以支持 Python2 执行它。

此 Bug 由 Format "mono" file 引入。在格式化之前,mono 脚本可以被 Python2 执行,格式化之后会报语法错误。

Why

Mono client 支持 Python 的最低版本是 3.6 (See main.py#L73 ),但 mono 作为起始脚本,依旧需要保证能在 Python2 中运行。

当用户操作系统中默认使用 Python2 时,mono 负责找到 Python3 并改用 Python3(这个聪明的逻辑在这里:check_python_version),而不是直接报错语法错误。

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

使用 Python2 执行 mono 脚本,在本 MR 修改前,会报错

$ python2 ~/.bin/mono
  File "/home/Deer/.bin/mono", line 404
    )
    ^
SyntaxError: invalid syntax

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

路志远 编辑于

合并请求报告