[Metrics] Fix box drawing on Windows, and refactor code.

The Unicode box drawing turn out malformed on Windows (even with
fix_encoding.py). This CL refactors the box drawing code, and makes
Windows box drawing use regular ASCII characters. Details:
* Add print_red_boxed_text() to programatically print box aroun given
  list og strings.
  * Unicode box drawing characters are escaped, removing the use of
    non-ASCII characters in source code.
* Convert message source to generators for greater flexibilty, and
  remove the need for manual horizontal padding.
* Add proper use colorama with Style.BRIGNT and Style.RESET_ALL.
* For Windows, revert to ASCII characters for box drawing.

Change-Id: I71a728db480709b4376d538aaecd701f9197e7ac
Reviewed-on: https://chromium-review.googlesource.com/c/1461249
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
1 file changed
tree: bb292aea351bb216211b6d41f01cbf944b28a8d6
  1. .gitattributes
  2. .gitignore
  3. .style.yapf
  4. CROS_OWNERS
  5. LICENSE
  6. OWNERS
  7. PRESUBMIT.py
  8. README.gclient.md
  9. README.git-cl.md
  10. README.md
  11. README.testing
  12. WATCHLISTS
  13. annotated_gclient.py
  14. appengine_mapper.py
  15. auth.py
  16. autoninja
  17. autoninja.bat
  18. autoninja.py
  19. bootstrap/
  20. breakpad.py
  21. buildbucket.py
  22. checkout.py
  23. cipd
  24. cipd.bat
  25. cipd.ps1
  26. cipd_bin_setup.bat
  27. cipd_bin_setup.sh
  28. cipd_client_version
  29. cipd_client_version.digests
  30. cipd_manifest.txt
  31. cipd_manifest.versions
  32. cit
  33. cit.bat
  34. cit.py
  35. clang-format
  36. clang-format.bat
  37. clang_format.py
  38. clang_format_merge_driver
  39. clang_format_merge_driver.bat
  40. clang_format_merge_driver.py
  41. codereview.settings
  42. compile_single_file
  43. compile_single_file.bat
  44. compile_single_file.py
  45. cpplint.bat
  46. cpplint.py
  47. cpplint_chromium.py
  48. dart_format.py
  49. depot-tools-auth
  50. depot-tools-auth.bat
  51. depot-tools-auth.py
  52. detect_host_arch.py
  53. download_from_google_storage
  54. download_from_google_storage.bat
  55. download_from_google_storage.py
  56. ensure_bootstrap
  57. fetch
  58. fetch.bat
  59. fetch.py
  60. fetch_configs/
  61. fix_encoding.py
  62. gclient
  63. gclient-new-workdir.py
  64. gclient.bat
  65. gclient.py
  66. gclient_completion.sh
  67. gclient_eval.py
  68. gclient_scm.py
  69. gclient_utils.py
  70. gerrit_client.py
  71. gerrit_util.py
  72. git-cache
  73. git-cl
  74. git-crrev-parse
  75. git-drover
  76. git-find-releases
  77. git-footers
  78. git-freeze
  79. git-gs
  80. git-hyper-blame
  81. git-map
  82. git-map-branches
  83. git-mark-merge-base
  84. git-nav-downstream
  85. git-nav-upstream
  86. git-new-branch
  87. git-number
  88. git-rebase-update
  89. git-rename-branch
  90. git-reparent-branch
  91. git-retry
  92. git-runhooks
  93. git-squash-branch
  94. git-templates/
  95. git-thaw
  96. git-upstream-diff
  97. git_cache.py
  98. git_cl.py
  99. git_cl_completion.sh
  100. git_common.py
  101. git_dates.py
  102. git_drover.py
  103. git_find_releases.py
  104. git_footers.py
  105. git_freezer.py
  106. git_hyper_blame.py
  107. git_map.py
  108. git_map_branches.py
  109. git_mark_merge_base.py
  110. git_nav_downstream.py
  111. git_new_branch.py
  112. git_number.py
  113. git_rebase_update.py
  114. git_rename_branch.py
  115. git_reparent_branch.py
  116. git_retry.py
  117. git_squash_branch.py
  118. git_upstream_diff.py
  119. gn
  120. gn.bat
  121. gn.py
  122. gsutil.py
  123. gsutil.py.bat
  124. gsutil.vpython
  125. infra/
  126. led
  127. led.bat
  128. luci-auth
  129. luci-auth.bat
  130. lucicfg
  131. lucicfg.bat
  132. mac_toolchain
  133. man/
  134. metrics.README.md
  135. metrics.py
  136. metrics_utils.py
  137. my_activity.py
  138. my_reviews.py
  139. ninja
  140. ninja-linux32
  141. ninja-linux64
  142. ninja-mac
  143. ninja.exe
  144. ninjalog.README.md
  145. ninjalog_uploader.py
  146. ninjalog_uploader_wrapper.py
  147. owners.py
  148. owners_finder.py
  149. patch.py
  150. post_build_ninja_summary.py
  151. presubmit_canned_checks.py
  152. presubmit_support.py
  153. profile.xml
  154. prpc
  155. prpc.bat
  156. pylint
  157. pylint.py
  158. pylintrc
  159. python_runner.sh
  160. recipes/
  161. repo
  162. rietveld.py
  163. roll-dep
  164. roll-dep-svn
  165. roll-dep-svn.bat
  166. roll-dep.bat
  167. roll_dep.py
  168. roll_dep_svn.py
  169. scm.py
  170. setup_color.py
  171. split_cl.py
  172. subcommand.py
  173. subprocess2.py
  174. support/
  175. testing_support/
  176. tests/
  177. third_party/
  178. update_depot_tools
  179. update_depot_tools.bat
  180. update_depot_tools_toggle.py
  181. upload_metrics.py
  182. upload_to_google_storage.py
  183. vpython
  184. vpython.bat
  185. watchlists.py
  186. weekly
  187. win_toolchain/
  188. wtf
  189. yapf
  190. yapf.bat
  191. zsh-goodies/
README.md

depot_tools

Tools for working with Chromium development. It requires python 2.7.

Tools

The most important tools are:

  • fetch: A gclient wrapper to checkout a project. Use fetch --help for more details.
  • gclient: A meta-checkout tool. Think repo or git submodules, except that it support OS-specific rules, e.g. do not checkout Windows only dependencies when checking out for Android. Use gclient help for more details and README.gclient.md.
  • git cl: A code review tool to interact with Rietveld or Gerrit. Use git cl help for more details and README.git-cl.md.
  • roll-dep: A gclient dependency management tool to submit a dep roll, updating a dependency to a newer revision.

There are a lot of git utilities included.

Updating

depot_tools updates itself automatically when running gclient tool. To disable auto update, set the environment variable DEPOT_TOOLS_UPDATE=0.

To update package manually, run update_depot_tools.bat on Windows, or ./update_depot_tools on Linux or Mac.

On Windows only, running gclient will install git and python.

Contributing

To contribute change for review:

git new-branch <somename>
# Hack
git add .
git commit -a -m "Fixes goat teleporting"
# find reviewers
git cl owners
git log -- <yourfiles>

# Request a review.
git cl upload -r reviewer1@chromium.org,reviewer2@chromium.org --send-mail

# Edit change description if needed.
git cl desc

# If change is approved, flag it to be committed.
git cl set-commit

# If change needs more work.
git rebase-update
...
git cl upload -t "Fixes goat teleporter destination to be Australia"

See also open bugs, open reviews, forum or report problems.

cpplint.py

Until 2018, our cpplint.py was a copy of the upstream version at https://github.com/google/styleguide/tree/gh-pages/cpplint. Unfortunately, that repository is not maintained any more. If you want to update cpplint.py in depot_tools, just upload a patch to do so. We will figure out a long-term strategy via issue https://crbug.com/916550.

Note that the cpplint.py here is also used by the Tricium analyzer, so if the cpplint.py here changes, we should also update the copy used there.