1 Star 50 Fork 8

ergmax/MinerU

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
update_version.py 850 Bytes
一键复制 编辑 原始数据 按行查看 历史
myhloli 提交于 2024-06-04 11:48 . fix error: version is 0.0.0
import os
import subprocess
def get_version():
command = ["git", "describe", "--tags"]
try:
version = subprocess.check_output(command).decode().strip()
version_parts = version.split("-")
if len(version_parts) > 1 and version_parts[0].startswith("magic_pdf"):
return version_parts[1]
else:
raise ValueError(f"Invalid version tag {version}. Expected format is magic_pdf-<version>-released.")
except Exception as e:
print(e)
return "0.0.0"
def write_version_to_commons(version):
commons_path = os.path.join(os.path.dirname(__file__), 'magic_pdf', 'libs', 'version.py')
with open(commons_path, 'w') as f:
f.write(f'__version__ = "{version}"\n')
if __name__ == '__main__':
version_name = get_version()
write_version_to_commons(version_name)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ergmax/MinerU.git
git@gitee.com:ergmax/MinerU.git
ergmax
MinerU
MinerU
master

搜索帮助