From 815989bc06c96085e121637a7c791dbecc1d9749 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 29 Jun 2023 15:39:05 -0400 Subject: [PATCH 1/4] Add error messages on usage of command line --- scripts/build_python.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/build_python.sh b/scripts/build_python.sh index 0952f3adbf7386..cdcc6f48f99cb6 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -82,6 +82,10 @@ while (($#)); do ;; --chip_detail_logging | -d) chip_detail_logging=$2 + if [[ "$chip_detail_logging" != "yes" && "$chip_detail_logging" != "no" ]]; then + echo "chip_detail_logging should have a yes/no value, not '$chip_detail_logging'" + exit + fi shift ;; --chip_mdns | -m) @@ -90,6 +94,10 @@ while (($#)); do ;; --enable_pybindings | -p) enable_pybindings=$2 + if [[ "$enable_pybindings" != "yes" && "$enable_pybindings" != "no" ]]; then + echo "enable_pybindings should have a yes/no value, not '$enable_pybindings'" + exit + fi shift ;; --time_between_case_retries | -t) @@ -98,14 +106,26 @@ while (($#)); do ;; --install_virtual_env | -i) install_virtual_env=$2 + if [[ "$install_virtual_env" != "yes" && "$install_virtual_env" != "no" ]]; then + echo "chip_virtual_env should have a yes/no value, not '$install_virtual_env'" + exit + fi shift ;; --clean_virtual_env | -c) clean_virtual_env=$2 + if [[ "$clean_virtual_env" != "yes" && "$clean_virtual_env" != "no" ]]; then + echo "clean_virtual_env should have a yes/no value, not '$clean_virtual_env'" + exit + fi shift ;; --include_pytest_deps) install_pytest_requirements=$2 + if [[ "$install_pytest_requirements" != "yes" && "$install_pytest_requirements" != "no" ]]; then + echo "install_pytest_requirements should have a yes/no value, not '$install_pytest_requirements'" + exit + fi shift ;; --extra_packages) From 138956e8448da8e7d480c6a4d081c476ce5777dd Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 29 Jun 2023 15:41:03 -0400 Subject: [PATCH 2/4] remove a non yes/no argument --- scripts/build_python.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/build_python.sh b/scripts/build_python.sh index cdcc6f48f99cb6..95e5cf7b0ed6ee 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -106,10 +106,6 @@ while (($#)); do ;; --install_virtual_env | -i) install_virtual_env=$2 - if [[ "$install_virtual_env" != "yes" && "$install_virtual_env" != "no" ]]; then - echo "chip_virtual_env should have a yes/no value, not '$install_virtual_env'" - exit - fi shift ;; --clean_virtual_env | -c) From 99efe8327a3ef273be1093580dbbfad13c721bff Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 29 Jun 2023 15:43:01 -0400 Subject: [PATCH 3/4] Update error syntax for 2 more arguments --- scripts/build_python.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build_python.sh b/scripts/build_python.sh index 95e5cf7b0ed6ee..33b979b4f52135 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -82,8 +82,8 @@ while (($#)); do ;; --chip_detail_logging | -d) chip_detail_logging=$2 - if [[ "$chip_detail_logging" != "yes" && "$chip_detail_logging" != "no" ]]; then - echo "chip_detail_logging should have a yes/no value, not '$chip_detail_logging'" + if [[ "$chip_detail_logging" != "true" && "$chip_detail_logging" != "false" ]]; then + echo "chip_detail_logging should have a true/false value, not '$chip_detail_logging'" exit fi shift @@ -94,8 +94,8 @@ while (($#)); do ;; --enable_pybindings | -p) enable_pybindings=$2 - if [[ "$enable_pybindings" != "yes" && "$enable_pybindings" != "no" ]]; then - echo "enable_pybindings should have a yes/no value, not '$enable_pybindings'" + if [[ "$enable_pybindings" != "true" && "$enable_pybindings" != "false" ]]; then + echo "enable_pybindings should have a true/false value, not '$enable_pybindings'" exit fi shift From 7ebf6589ccd8a66ef5636b8f65dbcdb4fe3cf794 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 29 Jun 2023 15:43:40 -0400 Subject: [PATCH 4/4] update the help. using both true/false and yes/no is a mess --- scripts/build_python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build_python.sh b/scripts/build_python.sh index 33b979b4f52135..08ad42965d5b99 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -52,11 +52,11 @@ help() { echo "General Options: -h, --help Display this information. Input Options: - -d, --chip_detail_logging ChipDetailLoggingValue Specify ChipDetailLoggingValue as true or false. + -d, --chip_detail_logging Specify ChipDetailLoggingValue as true or false. 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. + -p, --enable_pybindings Specify whether to enable pybindings as python controller. -t --time_between_case_retries MRPActiveRetryInterval Specify MRPActiveRetryInterval value Default is 300 ms