Ai
1 Star 1 Fork 0

Vzense/BaseSDK_python_wrapper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
install.py 2.93 KB
一键复制 编辑 原始数据 按行查看 历史
import sys
import subprocess
import os
import re
import shutil
# check modules
import numpy
import cv2
import ctypes
system_config = "Ubuntu18.04"
url_config = "https://gitee.com"
# py version >= 3.5
def execSysCommand(arglist):
ret = subprocess.run(arglist)
if ret.returncode == 0:
return 'success'
else:
return 'fail'
def pullSDK(url):
curPath = os.path.dirname(os.path.abspath(__file__))
sdkPath = curPath + "/tmp"
if not os.path.exists(sdkPath):
os.makedirs(sdkPath)
os.chdir(sdkPath)
curPath_ = os.getcwd()
if execSysCommand(url) == 'success':
# Windows
if system_config == 'Windows64' or system_config == 'Windows32':
src = sdkPath + "/Vzense_SDK_windows/Bin/x64"
if system_config != 'Windows64':
src = sdkPath + "/Vzense_SDK_windows/Bin/x86"
dst = curPath+ "/Lib"
if os.path.exists(dst):
shutil.rmtree(dst)
shutil.copytree(src, dst)
print("pull SDK success")
elif system_config == 'Ubuntu20.04' or system_config == 'Ubuntu18.04':
src = sdkPath + "/Vzense_SDK_linux/%s/Lib" %('Ubuntu18.04')
dst = curPath + "/Lib"
if os.path.exists(dst):
shutil.rmtree(dst)
shutil.move(src, dst)
print("pull SDK success")
else:
src = sdkPath + "/Vzense_SDK_linux/%s/Lib" %(system_config)
dst = curPath + "/Lib"
if os.path.exists(dst):
shutil.rmtree(dst)
shutil.move(src, dst)
print("pull SDK success")
else:
print("pull SDK fail")
def checkConfig():
global system_config
global url_config
curPath = os.path.dirname(os.path.abspath(__file__))
filename = curPath + "/config.txt"
with open(filename,"r") as fr:
lines = fr.readlines()
if len(lines) == 2 :
if re.search(r'system',lines[0], re.M|re.I) \
and re.search(r'url',lines[1], re.M|re.I):
tmp_list = lines[0].split('=')
if len(tmp_list) == 2:
system_config = tmp_list[1].strip()
tmp_list = lines[1].split('=')
if len(tmp_list) == 2:
if system_config == 'Windows64' or system_config == 'Windows32':
url_config = tmp_list[1].strip()+ '/Vzense/Vzense_SDK_windows.git'
else:
url_config = tmp_list[1].strip()+ '/Vzense/Vzense_SDK_linux.git'
return True
else:
return False
else:
return False
# check config.txt
if checkConfig() == True:
print(system_config)
print(url_config)
else:
print('check config.txt error, exit')
exit()
# git clone basesdk to tmp
cmdlist = ['git','clone','-b','V3.5.4','--depth=1',url_config]
pullSDK(cmdlist)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Vzense/BaseSDK_python_wrapper.git
git@gitee.com:Vzense/BaseSDK_python_wrapper.git
Vzense
BaseSDK_python_wrapper
BaseSDK_python_wrapper
master

搜索帮助