Commit 78789784 authored by yangql's avatar yangql
Browse files

Update setup.py

parent e1e4fabd
...@@ -71,7 +71,12 @@ def get_version_add(sha: Optional[str] = None) -> str: ...@@ -71,7 +71,12 @@ def get_version_add(sha: Optional[str] = None) -> str:
with open(add_version_path, 'r',encoding='utf-8') as file: with open(add_version_path, 'r',encoding='utf-8') as file:
lines = file.readlines() lines = file.readlines()
if len(lines) > 1:
lines[1] = "__dcu_version__ = '0.0.6+{}'\n".format(version) lines[1] = "__dcu_version__ = '0.0.6+{}'\n".format(version)
else:
# 如果文件行数不足,可以选择添加空行或者抛出异常
lines.append("__dcu_version__ = '0.0.6+{}'\n".format(version))
print("Added missing line to the file content.")
with open(add_version_path, encoding="utf-8",mode="w") as file: with open(add_version_path, encoding="utf-8",mode="w") as file:
file.writelines(lines) file.writelines(lines)
file.close() file.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment