pw_presubmit: Use python -m for pre-push hook

- Using __file__ as the presubmit hook causes the hook to refer to the
  version of the script installed in the venv. setuptools drops the
  executable permissions bit, so the pre-push hook cannot execute the
  presubmit checks. Instead of using the file path in the presubmit
  hook, invoke the checks with
  `python -m pw_presubmit.pigweed_presubmit`.
- Create install_git_hook(), a new version of the install_hook()
  function that takes the entire command as a list rather than splitting
  the command across two arguments.

Bug: b/234728287
Change-Id: Id513f8618094144ede7bbb1bb1e40140a71d3598
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/97222
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
3 files changed
tree: 1e91cf6b990cadcaa78a13c004bf5c635393e572
  1. build_overrides/
  2. docker/
  3. docs/
  4. pw_allocator/
  5. pw_analog/
  6. pw_android_toolchain/
  7. pw_arduino_build/
  8. pw_assert/
  9. pw_assert_basic/
  10. pw_assert_log/
  11. pw_assert_tokenized/
  12. pw_assert_zephyr/
  13. pw_base64/
  14. pw_bloat/
  15. pw_blob_store/
  16. pw_bluetooth_hci/
  17. pw_boot/
  18. pw_boot_cortex_m/
  19. pw_build/
  20. pw_build_info/
  21. pw_build_mcuxpresso/
  22. pw_bytes/
  23. pw_checksum/
  24. pw_chrono/
  25. pw_chrono_embos/
  26. pw_chrono_freertos/
  27. pw_chrono_stl/
  28. pw_chrono_threadx/
  29. pw_chrono_zephyr/
  30. pw_cli/
  31. pw_console/
  32. pw_containers/
  33. pw_cpu_exception/
  34. pw_cpu_exception_cortex_m/
  35. pw_crypto/
  36. pw_docgen/
  37. pw_doctor/
  38. pw_env_setup/
  39. pw_file/
  40. pw_function/
  41. pw_fuzzer/
  42. pw_hdlc/
  43. pw_hex_dump/
  44. pw_i2c/
  45. pw_i2c_mcuxpresso/
  46. pw_interrupt/
  47. pw_interrupt_cortex_m/
  48. pw_interrupt_zephyr/
  49. pw_kvs/
  50. pw_libc/
  51. pw_log/
  52. pw_log_android/
  53. pw_log_basic/
  54. pw_log_null/
  55. pw_log_rpc/
  56. pw_log_string/
  57. pw_log_tokenized/
  58. pw_log_zephyr/
  59. pw_malloc/
  60. pw_malloc_freelist/
  61. pw_metric/
  62. pw_minimal_cpp_stdlib/
  63. pw_module/
  64. pw_multisink/
  65. pw_package/
  66. pw_persistent_ram/
  67. pw_polyfill/
  68. pw_preprocessor/
  69. pw_presubmit/
  70. pw_protobuf/
  71. pw_protobuf_compiler/
  72. pw_random/
  73. pw_result/
  74. pw_ring_buffer/
  75. pw_router/
  76. pw_rpc/
  77. pw_snapshot/
  78. pw_software_update/
  79. pw_span/
  80. pw_spi/
  81. pw_status/
  82. pw_stm32cube_build/
  83. pw_stream/
  84. pw_string/
  85. pw_symbolizer/
  86. pw_sync/
  87. pw_sync_baremetal/
  88. pw_sync_embos/
  89. pw_sync_freertos/
  90. pw_sync_stl/
  91. pw_sync_threadx/
  92. pw_sync_zephyr/
  93. pw_sys_io/
  94. pw_sys_io_arduino/
  95. pw_sys_io_baremetal_lm3s6965evb/
  96. pw_sys_io_baremetal_stm32f429/
  97. pw_sys_io_emcraft_sf2/
  98. pw_sys_io_mcuxpresso/
  99. pw_sys_io_stdio/
  100. pw_sys_io_stm32cube/
  101. pw_sys_io_zephyr/
  102. pw_system/
  103. pw_target_runner/
  104. pw_thread/
  105. pw_thread_embos/
  106. pw_thread_freertos/
  107. pw_thread_stl/
  108. pw_thread_threadx/
  109. pw_tls_client/
  110. pw_tls_client_boringssl/
  111. pw_tls_client_mbedtls/
  112. pw_tokenizer/
  113. pw_tool/
  114. pw_toolchain/
  115. pw_trace/
  116. pw_trace_tokenized/
  117. pw_transfer/
  118. pw_unit_test/
  119. pw_varint/
  120. pw_watch/
  121. pw_web_ui/
  122. pw_work_queue/
  123. targets/
  124. third_party/
  125. zephyr/
  126. .bazelignore
  127. .bazelrc
  128. .clang-format
  129. .clang-tidy
  130. .eslintrc.json
  131. .gitattributes
  132. .gitignore
  133. .gn
  134. .prettierrc.js
  135. .pylintrc
  136. activate.bat
  137. Android.bp
  138. AUTHORS
  139. bootstrap.bat
  140. bootstrap.sh
  141. BUILD.bazel
  142. BUILD.gn
  143. BUILDCONFIG.gn
  144. CMakeLists.txt
  145. Kconfig.zephyr
  146. LICENSE
  147. modules.gni
  148. OWNERS
  149. package.json
  150. PIGWEED_MODULES
  151. PW_PLUGINS
  152. README.md
  153. tsconfig.json
  154. WORKSPACE
  155. yarn.lock
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/

Links