Switch //tools/md_browser to use cipd.

There are two standalone markdown-parsing tools in the repo,
one in //tools/md_browser and the other in //net/tools/net_docs.
Each uses a checked-in third-party copy of the Python markdown
library (two different versions).

Best practice these days for handling third-party packages of Python
code is to use CIPD if you can; this tightens up the
provenance better, hides the dependencies from the calling
code, and allows the calling code to just import the library
directly without doing any sys.path hacking.

We can't use CIPD to remove both uses of the library, as one
of the two uses happens during the build, and we're not allowed
to use vpython as a build action.

This change is motivated by crbug.com/14038, where we upgraded
//third_party/Python-Markdown from v3.3.4 to v3.4.1, but we
missed that the new version added a dependency on
`importlib-metadata`. Using CIPD packages would've caught that.

This CL switches md_browser to use vpython and CIPD, and
removes one of the two checked-in copies.

Bug: 140398
Change-Id: I583603e4c1318019b1b15391f52f989f4f8545f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4283145
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/main@{#1109359}
NOKEYCHECK=True
GitOrigin-RevId: 2983b3e42e6356ef5c9af903bf2c4a484aca7de6
1 file changed
tree: fb2f554f44a07cfe93c9540afa786d87c0f53a79
  1. .gitignore
  2. __init__.py
  3. base.css
  4. doc.css
  5. footer.html
  6. gitiles_autolink.py
  7. gitiles_ext_blocks.py
  8. gitiles_smart_quotes.py
  9. header.html
  10. md_browser.py
  11. OWNERS
  12. prettify.css
  13. README.md
  14. update-css.sh
README.md

md_browser

This is a simple tool to render the markdown docs in a chromium checkout locally. It is written in Python and uses the Python ‘markdown’ package, which is checked into src/third_party.

md_browser attempts to emulate the flavor of Markdown implemented by Gitiles.

Gitiles is the source browser running on https://chromium.googlesource.com, and can be run locally, but to do so requires a Java install and a Buck install, which can be slightly annoying to set up on Mac or Windows.

This is a lighterweight solution, which also allows you to preview uncommitted changes (i.e., it just serves files out of the filesystem, and is not a full Git repo browser like Gitiles is).

To run md_browser:

  1. cd to the top of your chromium checkout

  2. run python3 tools/md_browser/md_browser.py

  3. There is no step three.

This will run a local web server on port 8080 that points to the top of the repo. You can specify a different port with the -p flag.