diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65fc41468..b4ae9e071 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,8 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.6, 3.7, 3.8, 3.9] + python-architecture: [x64, x86] steps: - name: Cache .hunter folder uses: actions/cache@v2 @@ -32,9 +33,10 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.python-architecture }} - name: Append build hash if not a tagged commit if: startsWith(github.ref, 'refs/tags/v') != true - run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}' + run: echo "BUILD_COMMIT_HASH=${{github.sha}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Install dependencies run: | python -m pip install --upgrade pip @@ -51,7 +53,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - name: Cache .hunter folder uses: actions/cache@v2 @@ -67,14 +69,14 @@ jobs: python-version: ${{ matrix.python-version }} - name: Append build hash if not a tagged commit if: startsWith(github.ref, 'refs/tags/v') != true - run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}' + run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Install dependencies run: | python -m pip install --upgrade pip brew install libusb python -m pip install delocate - name: Set macos deployment target - run: echo '::set-env name=MACOSX_DEPLOYMENT_TARGET::10.9' + run: echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV - name: Building wheels run: python -m pip wheel . -w ./wheelhouse/ - name: Auditing wheels @@ -111,10 +113,10 @@ jobs: run: mkdir -p wheelhouse/audited/ - name: Append build hash if not a tagged commit if: startsWith(github.ref, 'refs/tags/v') != true - run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}' + run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building a source distribution run: | - /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar,zip + /opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar mv dist/* wheelhouse/audited/ - name: Building wheels run: for PYBIN in /opt/python/cp3*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/; done @@ -141,7 +143,7 @@ jobs: submodules: 'recursive' - name: Append build hash if not a tagged commit if: startsWith(github.ref, 'refs/tags/v') != true - run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}' + run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV - name: Building wheel run: python3 -m pip wheel . -w ./wheelhouse/ - name: Auditing wheel diff --git a/CMakeLists.txt b/CMakeLists.txt index 38379f64f..9147c392b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,10 +53,13 @@ target_link_libraries(${TARGET_NAME} # Add bindings revision target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_BINDINGS_REVISION="${PROJECT_VERSION}") -# Add commit hash, default to "dev" -if(NOT DEPTHAI_PYTHON_COMMIT_HASH) + +# Add default commit hash (dev) if not build by CI +if(NOT DEFINED ENV{CI} AND NOT DEPTHAI_PYTHON_COMMIT_HASH) set(DEPTHAI_PYTHON_COMMIT_HASH dev) endif() + +# Add compile definition for bindings if(DEPTHAI_PYTHON_COMMIT_HASH) target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_COMMIT_HASH="${DEPTHAI_PYTHON_COMMIT_HASH}") endif() diff --git a/depthai-core b/depthai-core index e3e5aeca7..96e2dc4a4 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit e3e5aeca7b015376f79669f9d7b766249b4d85ae +Subproject commit 96e2dc4a40dc608707a383cb398c8b86b4842294 diff --git a/src/device_bindings.cpp b/src/device_bindings.cpp index a76530545..307f2fc87 100644 --- a/src/device_bindings.cpp +++ b/src/device_bindings.cpp @@ -124,9 +124,76 @@ void init_binding_device(pybind11::module& m){ "Returns a vector defining how much the right camera is translated w.r.t left camera." ) + .def( + "is_usb3", + &Device::is_usb3, + "Return true if connected over usb3 or else false." + ) + + .def( + "get_mx_id", + &Device::get_mx_id, + "Return the Myraid X serial number of the device." + ) + + .def( + "is_eeprom_loaded", + &Device::is_eeprom_loaded, + "Return true if EEPROM has both intrinsic matrixes." + ) + .def( + "is_device_changed", + &Device::is_device_changed, + "Return true if device is swapped while running over watchdog thread." + ) + + .def( + "reset_device_changed", + &Device::reset_device_changed, + "Sets device_changed var to false to detect the next swap while running over watchdog thread." + ) + + .def( + "is_rgb_connected", + &Device::is_rgb_connected, + "Returns true if RGB camera is connected." + ) + + .def( + "is_left_connected", + &Device::is_left_connected, + "Returns true if left stereo camera is connected." + ) - ; + .def( + "is_right_connected", + &Device::is_right_connected, + "Returns true if right stereo camera is connected." + ) + .def( + "write_eeprom_data", + [](Device& device, py::dict config) + { + // str(dict) for string representation uses ['] , but JSON requires ["] + // fast & dirty solution: + std::string str = py::str(config); + boost::replace_all(str, "\'", "\""); + boost::replace_all(str, "None", "null"); + boost::replace_all(str, "True", "true"); + boost::replace_all(str, "False", "false"); + // TODO: make better json serialization + + return device.write_eeprom_data(str); + }, + "Takes board config and calibration data as input and writes to eeprom", + py::arg("config") = py::dict() + ) + .def( + "get_pipeline", + &Device::get_pipeline, + "Returns shared ptr of CNNHostPipeline created using cerate_pipeline." + ); py::enum_(m, "AutofocusMode")