1 Star 0 Fork 0

爱折腾智能机器人/depthai-python-ros2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
find_version.py 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
爱折腾智能机器人 提交于 2024-12-11 11:47 . add ros2
import sys
import os
import re
project_root = os.path.dirname(__file__)
version_depthai_core_path = project_root + "/" + "depthai-core/CMakeLists.txt"
version_depthai_python_path = project_root + "/" + "CMakeLists.txt"
cmake_lists_txt_version_pattern = r'project[\s]*\([^Vv]*version[\s]+((\"(?P<ver1>\S*)\"|(?P<ver2>\S*)\s))'
def get_version_from_cmake_lists(path):
with open(path, 'r') as file:
content = file.read()
match = re.search(cmake_lists_txt_version_pattern, content, flags=re.IGNORECASE)
ver1 = match.group('ver1')
ver2 = match.group('ver2')
version = ver1
if ver1 == None:
version = ver2
return version
def get_package_version():
version_core = '0.0.0'
version_revision = '0'
version_core = get_version_from_cmake_lists(version_depthai_core_path)
version_revision = get_version_from_cmake_lists(version_depthai_python_path)
package_version = version_core + '.' + version_revision
return package_version
def get_package_dev_version(commit_hash):
return get_package_version() + ".dev0+" + commit_hash
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ncnynl/depthai-python-ros2.git
git@gitee.com:ncnynl/depthai-python-ros2.git
ncnynl
depthai-python-ros2
depthai-python-ros2
master

搜索帮助