From b944cfbaef361ffc84d24e2de6bf1ad7ea20c15a Mon Sep 17 00:00:00 2001 From: Sigmund Augdal Date: Mon, 9 Oct 2023 09:30:39 +0200 Subject: [PATCH 1/4] Applied patches from build script --- Python/API/VzenseDS_api.py | 10 +++++----- Python/API/__init__.py | 0 Python/MANIFEST.in | 5 +++++ Python/setup.py | 17 +++++++++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 Python/API/__init__.py create mode 100644 Python/MANIFEST.in create mode 100644 Python/setup.py diff --git a/Python/API/VzenseDS_api.py b/Python/API/VzenseDS_api.py index 5d8e5ed..d4faa9a 100644 --- a/Python/API/VzenseDS_api.py +++ b/Python/API/VzenseDS_api.py @@ -21,15 +21,15 @@ def __init__(self): system_info = os_info.version print('version:',system_info) if system_info.find('18.04') != -1 or system_info.find('20.04') != -1: - libpath = (os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + "../../../"))+"/Ubuntu18.04/Lib/libNebula_api.so" + libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Ubuntu18.04/Lib/libNebula_api.so" print(libpath) self.vz_cam_lib = cdll.LoadLibrary(libpath) else: - libpath = (os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + "../../../"))+"/Ubuntu16.04/Lib/libNebula_api.so" + libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Ubuntu16.04/Lib/libNebula_api.so" print(libpath) self.vz_cam_lib = cdll.LoadLibrary(libpath) elif machine_ == 'aarch64': - libpath = (os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + "../../../"))+"/AArch64/Lib/libNebula_api.so" + libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/AArch64/Lib/libNebula_api.so" print(libpath) self.vz_cam_lib = cdll.LoadLibrary(libpath) else: @@ -38,11 +38,11 @@ def __init__(self): elif platform.system() == 'Windows': if machine_ == 'amd64': if architecture_ == '64bit': - libpath = (os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + "../../../"))+"/Windows/Bin/x64/Nebula_api.dll" + libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Windows/Bin/x64/Nebula_api.dll" print(libpath) self.vz_cam_lib = cdll.LoadLibrary(libpath) else: - libpath = (os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + "../../../"))+"/Windows/Bin/x86/Nebula_api.dll" + libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Windows/Bin/x86/Nebula_api.dll" print(libpath) self.vz_cam_lib = cdll.LoadLibrary(libpath) else: diff --git a/Python/API/__init__.py b/Python/API/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Python/MANIFEST.in b/Python/MANIFEST.in new file mode 100644 index 0000000..b961870 --- /dev/null +++ b/Python/MANIFEST.in @@ -0,0 +1,5 @@ +include API/LICENSE +recursive-include API/Ubuntu18.04/Lib * +recursive-include API/Ubuntu18.04/Include * +recursive-include API/Ubuntu16.04/Lib * +recursive-include API/Ubuntu16.04/Include * diff --git a/Python/setup.py b/Python/setup.py new file mode 100644 index 0000000..d6960f9 --- /dev/null +++ b/Python/setup.py @@ -0,0 +1,17 @@ +import os +from setuptools import setup + +version = os.environ.get("PKG_VERSION", "0.1") + +setup( + name="nebula", + version=version, + description="Nebula SDK source code", + author="Vzense Technology", + author_email="info@vzense.com", + url='https://github.com/Vzense/NebulaSDK', + packages=["API"], + include_package_data=True, + license="BSD", + install_requires=['numpy'], +) From 01927c8bf5e4fcdfd7b37b57c8a086777e778fc7 Mon Sep 17 00:00:00 2001 From: Sigmund Augdal Date: Mon, 9 Oct 2023 09:31:02 +0200 Subject: [PATCH 2/4] Use 18.04 binary on 22.04 --- Python/API/VzenseDS_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/API/VzenseDS_api.py b/Python/API/VzenseDS_api.py index d4faa9a..8012daf 100644 --- a/Python/API/VzenseDS_api.py +++ b/Python/API/VzenseDS_api.py @@ -20,7 +20,7 @@ def __init__(self): print('os_info:',type(os_info)) system_info = os_info.version print('version:',system_info) - if system_info.find('18.04') != -1 or system_info.find('20.04') != -1: + if system_info.find('18.04') != -1 or system_info.find('20.04') != -1 or system_info.find('22.04') != -1: libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Ubuntu18.04/Lib/libNebula_api.so" print(libpath) self.vz_cam_lib = cdll.LoadLibrary(libpath) From 145f21de25533e6b62ce95b1fccb0b299167cec9 Mon Sep 17 00:00:00 2001 From: Sigmund Augdal Date: Mon, 9 Oct 2023 09:35:45 +0200 Subject: [PATCH 3/4] Added missing enum values to python api --- Python/API/VzenseDS_enums.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Python/API/VzenseDS_enums.py b/Python/API/VzenseDS_enums.py index 270f85b..4b8d788 100644 --- a/Python/API/VzenseDS_enums.py +++ b/Python/API/VzenseDS_enums.py @@ -41,6 +41,12 @@ class VzReturnStatus(Enum): VzRetUpgradeImgError = -17 VzRetUpgradeImgPathTooLong = -18 VzRetUpgradeCallbackNotSet = -19 + VzRetProductNotSupport = -20 + VzRetNoConfigFolder = -21 + VzRetWebServerStartError = -22 + VzRetGetOverStayFrame = -23 + VzRetCreateLogDirError = -24 + VzRetCreateLogFileError = -25 VzRetNoAdapterConnected = -100 VzRetReInitialized = -101 VzRetNoInitialized = -102 @@ -50,6 +56,7 @@ class VzReturnStatus(Enum): VzRetIPNotMatch = -106 VzRetNotStopStream = -107 VzRetNotStartStream = -108 + VzRetNoDriversFolder = -109 VzRetOthers = -255 class VzConnectStatus(Enum): From f7c7357ae4779f4d51c8a690506d2823ae634b4b Mon Sep 17 00:00:00 2001 From: daglof Date: Wed, 1 Nov 2023 11:09:06 +0100 Subject: [PATCH 4/4] Always load Ubuntu18.04 library --- Python/API/VzenseDS_api.py | 48 ++++---------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/Python/API/VzenseDS_api.py b/Python/API/VzenseDS_api.py index 8012daf..690b965 100644 --- a/Python/API/VzenseDS_api.py +++ b/Python/API/VzenseDS_api.py @@ -8,50 +8,10 @@ class VzenseTofCam(): device_handle = c_void_p(0) def __init__(self): - system_ = platform.system().lower() - machine_ = platform.machine().lower() - architecture_ = platform.architecture()[0] - print('system:',system_) - print('machine_:',machine_) - print('architecture:',architecture_) - if system_ == 'linux': - if machine_ == 'x86_64': - os_info = os.uname() - print('os_info:',type(os_info)) - system_info = os_info.version - print('version:',system_info) - if system_info.find('18.04') != -1 or system_info.find('20.04') != -1 or system_info.find('22.04') != -1: - libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Ubuntu18.04/Lib/libNebula_api.so" - print(libpath) - self.vz_cam_lib = cdll.LoadLibrary(libpath) - else: - libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Ubuntu16.04/Lib/libNebula_api.so" - print(libpath) - self.vz_cam_lib = cdll.LoadLibrary(libpath) - elif machine_ == 'aarch64': - libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/AArch64/Lib/libNebula_api.so" - print(libpath) - self.vz_cam_lib = cdll.LoadLibrary(libpath) - else: - print('do not supported OS', system_, machine_) - exit() - elif platform.system() == 'Windows': - if machine_ == 'amd64': - if architecture_ == '64bit': - libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Windows/Bin/x64/Nebula_api.dll" - print(libpath) - self.vz_cam_lib = cdll.LoadLibrary(libpath) - else: - libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep))+"/Windows/Bin/x86/Nebula_api.dll" - print(libpath) - self.vz_cam_lib = cdll.LoadLibrary(libpath) - else: - print('do not supported OS', system_, machine_) - exit() - else: - print('do not supported OS', system_, machine_) - exit() - + + libpath = (os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.path.sep)) + "/Ubuntu18.04/Lib/libNebula_api.so" + self.vz_cam_lib = cdll.LoadLibrary(libpath) + self.device_handle = c_void_p(0) self.vz_cam_lib.VZ_Initialize()