diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b55417cdba78ed..8c618416fba4c1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -54,7 +54,6 @@ updates: - dependency-name: "third_party/open-iot-sdk/repo" - dependency-name: "third_party/ot-br-posix/repo" - dependency-name: "third_party/perfetto/repo" - - dependency-name: "third_party/pybind11/repo" - dependency-name: "third_party/qpg_sdk/repo" - dependency-name: "third_party/silabs/repo" - dependency-name: "third_party/simw-top-mini/repo" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3ec8fd379c3fe7..58e6d14cd8bb0e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -308,7 +308,7 @@ jobs: - name: Setup Build, Run Build and Run Tests run: | - scripts/build/gn_gen.sh --args="enable_rtti=true enable_pylib=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false" + scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false" scripts/run_in_build_env.sh "ninja -C ./out" scripts/tests/gn_tests.sh - name: Setup test python environment @@ -414,7 +414,6 @@ jobs: # "host clang" build, which uses the pigweed # clang. "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';; - "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';; esac BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" diff --git a/.gitmodules b/.gitmodules index 1f4129f9f2df9d..0b015f8d14cd16 100644 --- a/.gitmodules +++ b/.gitmodules @@ -165,10 +165,6 @@ path = third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a url = https://github.com/Infineon/recipe-make-cat1a platforms = infineon -[submodule "third_party/pybind11/repo"] - path = third_party/pybind11/repo - url = https://github.com/pybind/pybind11 - branch = stable [submodule "p6/lwip"] path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip url = https://github.com/lwip-tcpip/lwip.git diff --git a/BUILD.gn b/BUILD.gn index 8a78d8f55f3bd0..c8e41976599173 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -44,7 +44,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { chip_enable_python_modules = (current_os == "mac" || current_os == "linux") && (host_cpu == "x64" || host_cpu == "arm64" || host_cpu == "arm") - enable_pylib = false # Build the Linux all clusters app example with default group chip_build_all_clusters_app = false @@ -112,9 +111,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { "${chip_root}/src/controller/python:chip-repl", "${chip_root}/src/python_testing/matter_testing_infrastructure:metadata_parser.wheel", ] - if (enable_pylib) { - deps += [ "${chip_root}/src/pybindings/pycontroller" ] - } } } @@ -214,9 +210,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { data_deps = [ "${chip_root}/examples/chip-tool" ] if (chip_enable_python_modules) { - if (enable_pylib) { - data_deps += [ "${chip_root}/src/pybindings/pycontroller" ] - } data_deps += [ "${chip_root}/src/controller/python:chip-repl" ] } diff --git a/scripts/build_python.sh b/scripts/build_python.sh index e70b220130935d..9bb919605e229c 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -39,7 +39,6 @@ OUTPUT_ROOT="$CHIP_ROOT/out/python_lib" declare enable_ble=true declare chip_detail_logging=false -declare enable_pybindings=false declare chip_mdns declare case_retry_delta declare install_virtual_env @@ -49,7 +48,7 @@ declare install_jupyterlab=no help() { - echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ] [-enable_pybindings EnableValue]" + echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ]" echo "General Options: -h, --help Display this information. @@ -59,8 +58,6 @@ Input Options: By default it is false. -m, --chip_mdns ChipMDNSValue Specify ChipMDNSValue as platform or minimal. By default it is minimal. - -p, --enable_pybindings Specify whether to enable pybindings as python controller. - -t --time_between_case_retries MRPActiveRetryInterval Specify MRPActiveRetryInterval value Default is 300 ms -i, --install_virtual_env Create a virtual environment with the wheels installed @@ -104,14 +101,6 @@ while (($#)); do chip_mdns=$2 shift ;; - --enable_pybindings | -p) - enable_pybindings=$2 - if [[ "$enable_pybindings" != "true" && "$enable_pybindings" != "false" ]]; then - echo "enable_pybindings should have a true/false value, not '$enable_pybindings'" - exit - fi - shift - ;; --time_between_case_retries | -t) chip_case_retry_delta=$2 shift @@ -157,7 +146,7 @@ while (($#)); do done # Print input values -echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\", enable_pybindings = $enable_pybindings, chip_case_retry_delta=\"$chip_case_retry_delta\", pregen_dir=\"$pregen_dir\", enable_ble=\"$enable_ble\"" +echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\", chip_case_retry_delta=\"$chip_case_retry_delta\", pregen_dir=\"$pregen_dir\", enable_ble=\"$enable_ble\"" # Ensure we have a compilation environment source "$CHIP_ROOT/scripts/activate.sh" @@ -184,7 +173,7 @@ export SYSTEM_VERSION_COMPAT=0 # Make all possible human redable tracing available. tracing_options="matter_log_json_payload_hex=true matter_log_json_payload_decode_full=true matter_enable_tracing_support=true" -gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble chip_crypto=\"boringssl\"" +gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble chip_crypto=\"boringssl\"" function ninja_target() { # Print the ninja target required to build a gn label. @@ -206,11 +195,7 @@ function wheel_output_dir() { ninja -C "$OUTPUT_ROOT" python_wheels # Add wheels from chip_python_wheel_action templates. -if [ "$enable_pybindings" == true ]; then - WHEEL=("$OUTPUT_ROOT"/pybindings/pycontroller/pychip-*.whl) -else - WHEEL=("$OUTPUT_ROOT"/controller/python/chip*.whl) -fi +WHEEL=("$OUTPUT_ROOT"/controller/python/chip*.whl) # Add the matter_testing_infrastructure wheel WHEEL+=("$OUTPUT_ROOT"/python/obj/src/python_testing/matter_testing_infrastructure/metadata_parser._build_wheel/metadata_parser-*.whl) diff --git a/scripts/build_python_device.sh b/scripts/build_python_device.sh index 894ea1bad61c8b..9b21d28954c409 100755 --- a/scripts/build_python_device.sh +++ b/scripts/build_python_device.sh @@ -39,12 +39,11 @@ OUTPUT_ROOT="$CHIP_ROOT/out/python_lib" ENVIRONMENT_ROOT="$CHIP_ROOT/out/python_env" declare chip_detail_logging=false -declare enable_pybindings=false declare chip_mdns help() { - echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ] [-enable_pybindings EnableValue]" + echo "Usage: $file_name [ options ... ] [ -chip_detail_logging ChipDetailLoggingValue ] [ -chip_mdns ChipMDNSValue ]" echo "General Options: -h, --help Display this information. @@ -53,7 +52,6 @@ Input Options: By default it is false. -m, --chip_mdns ChipMDNSValue Specify ChipMDNSValue as platform or minimal. By default it is minimal. - -p, --enable_pybindings EnableValue Specify whether to enable pybindings as python controller. " } @@ -73,10 +71,6 @@ while (($#)); do chip_mdns=$2 shift ;; - --enable_pybindings | -p) - enable_pybindings=$2 - shift - ;; -*) help echo "Unknown Option \"$1\"" @@ -87,7 +81,7 @@ while (($#)); do done # Print input values -echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\", enable_pybindings = $enable_pybindings" +echo "Input values: chip_detail_logging = $chip_detail_logging , chip_mdns = \"$chip_mdns\"" # Ensure we have a compilation environment source "$CHIP_ROOT/scripts/activate.sh" @@ -97,26 +91,17 @@ source "$CHIP_ROOT/scripts/activate.sh" chip_data_model_arg="chip_data_model=\"///examples/lighting-app/lighting-common\"" -gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings $chip_mdns_arg chip_controller=false $chip_data_model_arg" +gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="chip_detail_logging=$chip_detail_logging $chip_mdns_arg chip_controller=false $chip_data_model_arg" # Compiles python files -# Check pybindings was requested -if [ "$enable_pybindings" == true ]; then - ninja -v -C "$OUTPUT_ROOT" pycontroller -else - ninja -v -C "$OUTPUT_ROOT" chip-core -fi +ninja -v -C "$OUTPUT_ROOT" chip-core # Create a virtual environment that has access to the built python tools virtualenv --clear "$ENVIRONMENT_ROOT" # Activate the new environment to register the python WHL -if [ "$enable_pybindings" == true ]; then - WHEEL=("$OUTPUT_ROOT"/pybindings/pycontroller/pychip-*.whl) -else - WHEEL=("$OUTPUT_ROOT"/controller/python/chip_core*.whl) -fi +WHEEL=("$OUTPUT_ROOT"/controller/python/chip_core*.whl) source "$ENVIRONMENT_ROOT"/bin/activate "$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade pip diff --git a/scripts/tools/check_includes_config.py b/scripts/tools/check_includes_config.py index 8790faf1666b08..2af375d7c4bdfd 100644 --- a/scripts/tools/check_includes_config.py +++ b/scripts/tools/check_includes_config.py @@ -29,7 +29,6 @@ '/java/', '/Jni', '/mock/', - '/pybindings/', '/python/', '/Test', '/tests/', diff --git a/src/pybindings/pycontroller/BUILD.gn b/src/pybindings/pycontroller/BUILD.gn deleted file mode 100644 index 0949f7baf7661a..00000000000000 --- a/src/pybindings/pycontroller/BUILD.gn +++ /dev/null @@ -1,175 +0,0 @@ -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/pigweed.gni") - -import("$dir_pw_build/python.gni") - -import("${chip_root}/build/chip/tools.gni") -import("${chip_root}/src/platform/device.gni") -import("${dir_pw_unit_test}/test.gni") - -if (current_os == "mac") { - import("${build_root}/config/mac/mac_sdk.gni") -} - -config("controller_wno_deprecate") { - cflags = [ - "-Wno-deprecated-declarations", - "-Wno-shadow", - "-Wno-unused-result", - "-Wsign-compare", - "-Wunreachable-code", - "-Wno-macro-redefined", - ] -} - -shared_library("CHIPController") { - configs -= [ "//build/config/compiler:exceptions_default" ] - - output_name = "PyChip" - output_dir = "${target_out_dir}/pychip" - - # TODO: Update to use GN tools to get actual paths - include_dirs = [ "${chip_root}/third_party/pybind11/repo/include" ] - if (current_os == "mac") { - include_dirs += - [ "${chip_root}/.environment/cipd/packages/python/include/python3.9" ] - } else if (current_os == "linux") { - include_dirs += [ "/usr/include/python3.9" ] - } else { - assert(false, "OS not supported.") - } - - sources = [ - "ControllerBindings/PyChip_ChipError.cpp", - "ControllerBindings/PyChip_ErrorStr.cpp", - "ControllerBindings/PyChip_Main.cpp", - ] - - public_deps = [ - "${chip_root}/src/app", - "${chip_root}/src/controller/data_model", - "${chip_root}/src/lib", - "${chip_root}/src/lib/core", - "${chip_root}/src/lib/dnssd", - "${chip_root}/src/lib/support", - "${chip_root}/src/platform", - "${chip_root}/src/platform/logging:default", - "${chip_root}/src/setup_payload", - "${chip_root}/src/tracing/json", - "${chip_root}/src/tracing/perfetto", - "${chip_root}/src/tracing/perfetto:file_output", - "${chip_root}/src/transport", - "${chip_root}/third_party/jsoncpp", - ] - deps = [ - "${chip_root}/src/tracing/perfetto:event_storage", - "${chip_root}/src/tracing/perfetto:simple_initialization", - ] - configs += [ ":controller_wno_deprecate" ] - if (current_os == "mac") { - ldflags = [ - "-undefined", - "dynamic_lookup", - ] - } - if (current_os == "linux") { - libs = [ "python3.9" ] - } -} - -pw_python_action("pycontroller") { - script = "build-chip-wheel.py" - - _py_manifest_files = [ - { - src_dir = "." - sources = [ "pychip/__init__.py" ] - }, - { - src_dir = target_out_dir - sources = [ "${target_out_dir}/pychip/PyChip.so" ] - }, - { - src_dir = "//" - sources = [ "//LICENSE" ] - }, - ] - - _py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json" - - inputs = [] - _py_manifest_files_rebased = [] - foreach(_manifest_entry, _py_manifest_files) { - inputs += _manifest_entry.sources - _py_manifest_files_rebased += [ - { - src_dir = rebase_path(_manifest_entry.src_dir, - get_path_info(_py_manifest_file, "dir")) - sources = rebase_path(_manifest_entry.sources, _manifest_entry.src_dir) - }, - ] - } - - _py_manifest = { - files = _py_manifest_files_rebased - } - - write_file(_py_manifest_file, _py_manifest, "json") - - _dist_dir = "${root_out_dir}/pybindings/pycontroller" - - if (current_cpu == "x64") { - cpu_tag = "x86_64" - } else if (current_cpu == "arm64") { - cpu_tag = "aarch64" - } else { - cpu_tag = current_cpu - } - - if (current_os == "mac") { - platform_tag = string_replace( - string_replace(mac_deployment_target, "macos", "macosx."), - ".", - "_") - } else { - platform_tag = current_os - } - - platform_tag = platform_tag + "_" + cpu_tag - - tags = "cp37-" + platform_tag - - args = [ - "--package_name", - "pychip", - "--build_number", - "0.0", - "--build_dir", - rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir), - "--dist_dir", - rebase_path(_dist_dir, root_build_dir), - "--manifest", - rebase_path(_py_manifest_file, root_build_dir), - "--plat-name", - platform_tag, - ] - - public_deps = [ ":CHIPController" ] - - output_name = "pychip-0.0.dist-info-0.0-${tags}.whl" - outputs = [ "${_dist_dir}/$output_name" ] -} diff --git a/src/pybindings/pycontroller/ControllerBindings/PyChip_ChipError.cpp b/src/pybindings/pycontroller/ControllerBindings/PyChip_ChipError.cpp deleted file mode 100644 index d1fc3cf67b11ac..00000000000000 --- a/src/pybindings/pycontroller/ControllerBindings/PyChip_ChipError.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include - -#include -#include -#include - -#ifndef BINDER_PYBIND11_TYPE_CASTER -#define BINDER_PYBIND11_TYPE_CASTER -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr) -PYBIND11_DECLARE_HOLDER_TYPE(T, T *) -PYBIND11_MAKE_OPAQUE(std::shared_ptr) -#endif - -void bind_PyChip_ChipError(std::function & M) -{ - { - pybind11::class_> cl( - M("chip"), "ChipError", - "This is a helper class for managing `CHIP_ERROR` numbers.\n\n At the top level, an error belongs to a `Range` and has " - "an integral Value whose meaning depends on the `Range`.\n One, `Range::kSDK`, is used for the CHIP SDK's own errors; " - "others encapsulate error codes from external sources\n (e.g. libraries, OS) into a `CHIP_ERROR`.\n\n CHIP SDK errors " - "inside `Range::kSDK` consist of a component identifier given by `SdkPart` and an arbitrary small\n integer Code."); - cl.def(pybind11::init([]() { return new chip::ChipError(); })); - cl.def(pybind11::init(), pybind11::arg("error")); - - cl.def(pybind11::init([](chip::ChipError const & o) { return new chip::ChipError(o); })); - - pybind11::enum_(cl, "Range", "Top-level error classification.") - .value("kSDK", chip::ChipError::Range::kSDK) - .value("kOS", chip::ChipError::Range::kOS) - .value("kPOSIX", chip::ChipError::Range::kPOSIX) - .value("kLwIP", chip::ChipError::Range::kLwIP) - .value("kOpenThread", chip::ChipError::Range::kOpenThread) - .value("kPlatform", chip::ChipError::Range::kPlatform); - - pybind11::enum_(cl, "SdkPart", "Secondary classification of errors in `Range::kSDK`.") - .value("kCore", chip::ChipError::SdkPart::kCore) - .value("kInet", chip::ChipError::SdkPart::kInet) - .value("kDevice", chip::ChipError::SdkPart::kDevice) - .value("kASN1", chip::ChipError::SdkPart::kASN1) - .value("kBLE", chip::ChipError::SdkPart::kBLE) - .value("kApplication", chip::ChipError::SdkPart::kApplication); - - cl.def("__eq__", (bool(chip::ChipError::*)(const class chip::ChipError &) const) & chip::ChipError::operator==, - "C++: chip::ChipError::operator==(const class chip::ChipError &) const --> bool", pybind11::arg("other")); - cl.def("__ne__", (bool(chip::ChipError::*)(const class chip::ChipError &) const) & chip::ChipError::operator!=, - "C++: chip::ChipError::operator!=(const class chip::ChipError &) const --> bool", pybind11::arg("other")); - cl.def_static("IsSuccess", (bool (*)(unsigned int)) & chip::ChipError::IsSuccess, - "C++: chip::ChipError::IsSuccess(unsigned int) --> bool", pybind11::arg("error")); - cl.def_static("IsSuccess", (bool (*)(class chip::ChipError)) & chip::ChipError::IsSuccess, - "C++: chip::ChipError::IsSuccess(class chip::ChipError) --> bool", pybind11::arg("error")); - } - M("chip").def("RegisterCHIPLayerErrorFormatter", (void (*)()) & chip::RegisterCHIPLayerErrorFormatter, - "C++: chip::RegisterCHIPLayerErrorFormatter() --> void"); - - M("chip").def("FormatCHIPError", (bool (*)(char *, unsigned short, unsigned int)) & chip::FormatCHIPError, - "C++: chip::FormatCHIPError(char *, unsigned short, unsigned int) --> bool", pybind11::arg("buf"), - pybind11::arg("bufSize"), pybind11::arg("err")); -} diff --git a/src/pybindings/pycontroller/ControllerBindings/PyChip_ErrorStr.cpp b/src/pybindings/pycontroller/ControllerBindings/PyChip_ErrorStr.cpp deleted file mode 100644 index b59424d10d087d..00000000000000 --- a/src/pybindings/pycontroller/ControllerBindings/PyChip_ErrorStr.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include - -#include -#include -#include - -#ifndef BINDER_PYBIND11_TYPE_CASTER -#define BINDER_PYBIND11_TYPE_CASTER -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr) -PYBIND11_DECLARE_HOLDER_TYPE(T, T *) -PYBIND11_MAKE_OPAQUE(std::shared_ptr) -#endif - -void bind_PyChip_ErrorStr(std::function & M) -{ - { - pybind11::class_> cl(M("chip"), "ErrorFormatter", ""); - cl.def(pybind11::init([]() { return new chip::ErrorFormatter(); })); - } - M("chip").def("ErrorStr", (const char * (*) (CHIP_ERROR)) & chip::ErrorStr, - "C++: chip::ErrorStr(unsigned int) --> const char *", pybind11::return_value_policy::automatic, - pybind11::arg("err")); - - M("chip").def("RegisterErrorFormatter", (void (*)(struct chip::ErrorFormatter *)) & chip::RegisterErrorFormatter, - "C++: chip::RegisterErrorFormatter(struct chip::ErrorFormatter *) --> void", pybind11::arg("errFormatter")); - - M("chip").def("DeregisterErrorFormatter", (void (*)(struct chip::ErrorFormatter *)) & chip::DeregisterErrorFormatter, - "C++: chip::DeregisterErrorFormatter(struct chip::ErrorFormatter *) --> void", pybind11::arg("errFormatter")); - - M("chip").def("FormatError", (void (*)(char *, unsigned short, const char *, unsigned int, const char *)) & chip::FormatError, - "C++: chip::FormatError(char *, unsigned short, const char *, unsigned int, const char *) --> void", - pybind11::arg("buf"), pybind11::arg("bufSize"), pybind11::arg("subsys"), pybind11::arg("err"), - pybind11::arg("desc")); -} diff --git a/src/pybindings/pycontroller/ControllerBindings/PyChip_Main.cpp b/src/pybindings/pycontroller/ControllerBindings/PyChip_Main.cpp deleted file mode 100644 index d7cc4effcb3197..00000000000000 --- a/src/pybindings/pycontroller/ControllerBindings/PyChip_Main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include - -#include - -typedef std::function ModuleGetter; - -void bind_PyChip_ErrorStr(std::function & M); -void bind_PyChip_ChipError(std::function & M); - -PYBIND11_MODULE(PyChip, root_module) -{ - root_module.doc() = "PyChip module"; - - std::map modules; - ModuleGetter M = [&](std::string const & namespace_) -> pybind11::module & { - auto it = modules.find(namespace_); - if (it == modules.end()) - throw std::runtime_error("Attempt to access pybind11::module for namespace " + namespace_ + " that does not exist!!!"); - return it->second; - }; - - modules[""] = root_module; - - std::vector> sub_modules{ { "", "chip" } }; - for (auto & p : sub_modules) - modules[p.first.size() ? p.first + "::" + p.second : p.second] = - modules[p.first].def_submodule(p.second.c_str(), ("Bindings for " + p.first + "::" + p.second + " namespace").c_str()); - - bind_PyChip_ErrorStr(M); - bind_PyChip_ChipError(M); -} diff --git a/src/pybindings/pycontroller/build-chip-wheel.py b/src/pybindings/pycontroller/build-chip-wheel.py deleted file mode 100644 index 61bdf373e8615c..00000000000000 --- a/src/pybindings/pycontroller/build-chip-wheel.py +++ /dev/null @@ -1,191 +0,0 @@ -# -# Copyright (c) 2020 Project CHIP Authors -# Copyright (c) 2019 Google LLC. -# All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Description: -# Builds a Python wheel package for CHIP. -# - -from __future__ import absolute_import - -import argparse -import json -import os -import platform -import shutil - -from setuptools import setup -from wheel.bdist_wheel import bdist_wheel - -parser = argparse.ArgumentParser( - description='build the pip package for chip using chip components generated during the build and python source code') -parser.add_argument('--package_name', default='chip', - help='configure the python package name') -parser.add_argument('--build_number', default='0.0', - help='configure the chip build number') -parser.add_argument('--build_dir', help='directory to build in') -parser.add_argument('--dist_dir', help='directory to place distribution in') -parser.add_argument('--manifest', help='list of files to package') -parser.add_argument( - '--plat-name', help='platform name to embed in generated filenames') - -args = parser.parse_args() - - -class InstalledScriptInfo: - """Information holder about a script that is to be installed.""" - - def __init__(self, name): - self.name = name - self.installName = os.path.splitext(name)[0] - - -chipDLLName = 'PyChip.so' -packageName = args.package_name -chipPackageVer = args.build_number - -installScripts = [ - # InstalledScriptInfo('chip-repl.py'), -] - -# Record the current directory at the start of execution. -curDir = os.curdir - -manifestFile = os.path.abspath(args.manifest) -buildDir = os.path.abspath(args.build_dir) -distDir = os.path.abspath(args.dist_dir) - -# Use a temporary directory within the build directory to assemble the components -# for the installable package. -tmpDir = os.path.join(buildDir, 'pychip-wheel-components') - -manifest = json.load(open(manifestFile, 'r')) - -try: - - # - # Perform a series of setup steps prior to creating the chip package... - # - - # Create the temporary components directory. - if os.path.isdir(tmpDir): - shutil.rmtree(tmpDir) - os.makedirs(tmpDir, exist_ok=True) - - # Switch to the temporary directory. (Foolishly, setuptools relies on the current directory - # for many of its features.) - os.chdir(tmpDir) - - manifestBase = os.path.dirname(manifestFile) - for entry in manifest['files']: - srcDir = os.path.join(manifestBase, entry['src_dir']) - for path in entry['sources']: - srcFile = os.path.join(srcDir, path) - dstFile = os.path.join(tmpDir, path) - os.makedirs(os.path.dirname(dstFile), exist_ok=True) - shutil.copyfile(srcFile, dstFile) - - for script in installScripts: - os.rename(os.path.join(tmpDir, script.name), - os.path.join(tmpDir, script.installName)) - - # Define a custom version of the bdist_wheel command that configures the - # resultant wheel as platform-specific (i.e. not "pure"). - class bdist_wheel_override(bdist_wheel): - def finalize_options(self): - bdist_wheel.finalize_options(self) - self.root_is_pure = False - - requiredPackages = [ - "coloredlogs", - 'construct', - 'ipython', - ] - - if platform.system() == 'Darwin': - requiredPackages.append('pyobjc-framework-corebluetooth') - - if platform.system() == 'Linux': - requiredPackages.append('pygobject') - - # - # Build the chip package... - # - packages = [ - 'pychip', - ] - - # Invoke the setuptools 'bdist_wheel' command to generate a wheel containing - # the CHIP python packages, shared libraries and scripts. - setup( - name=packageName, - version=chipPackageVer, - description='Python-base APIs and tools for CHIP.', - url='https://github.com/project-chip/connectedhomeip', - license='Apache', - classifiers=[ - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - ], - python_requires='>=2.7', - packages=packages, - package_dir={ - # By default, look in the tmp directory for packages/modules to be included. - '': tmpDir, - }, - package_data={ - packageName: [ - # Include the wrapper DLL as package data in the "chip" package. - chipDLLName - ] - }, - scripts=[name for name in map( - lambda script: os.path.join(tmpDir, script.installName), - installScripts - )], - install_requires=requiredPackages, - options={ - 'bdist_wheel': { - 'universal': False, - # Place the generated .whl in the dist directory. - 'dist_dir': distDir, - 'py_limited_api': 'cp37', - 'plat_name': args.plat_name, - }, - 'egg_info': { - # Place the .egg-info subdirectory in the tmp directory. - 'egg_base': tmpDir - } - }, - cmdclass={ - 'bdist_wheel': bdist_wheel_override - }, - script_args=['clean', '--all', 'bdist_wheel'] - ) - -finally: - - # Switch back to the initial current directory. - os.chdir(curDir) - - # Remove the temporary directory. - if os.path.isdir(tmpDir): - shutil.rmtree(tmpDir) diff --git a/src/pybindings/pycontroller/pychip/__init__.py b/src/pybindings/pycontroller/pychip/__init__.py deleted file mode 100644 index c2020be2dc7a4f..00000000000000 --- a/src/pybindings/pycontroller/pychip/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ - -from .PyChip import chip - -__all__ = [chip] diff --git a/third_party/pybind11/repo b/third_party/pybind11/repo deleted file mode 160000 index 8b03ffa7c06cd9..00000000000000 --- a/third_party/pybind11/repo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8b03ffa7c06cd9c8a38297b1c8923695d1ff1b07