From bb9a927bd5477026b871ed5466ec188de8306d81 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 21 Oct 2018 14:45:04 -0400 Subject: Add yapf to third_party. --- Docs.md | 4 ---- gclient_config.py | 5 +++++ third_party | 2 +- tools/format.py | 7 +++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Docs.md b/Docs.md index 89fa01c05..069a0e8b6 100644 --- a/Docs.md +++ b/Docs.md @@ -114,10 +114,6 @@ submodule. However, you need to install separately: 3. Enable `Debugging Tools for Windows`, Goto Control Panel -> Windows 10 SDK -> Right-Click -> Change -> Change -> Check Debugging Tools for Windows -> Change -> Finish -6. Before running `./tools/format.py`, make sure you have `yapf` installed for - the current Python and `rustfmt` for Rust. They can be installed by: - - pip install yapf rustup component add rustfmt-preview ### Build: diff --git a/gclient_config.py b/gclient_config.py index 93d744a3f..dc4a75e5b 100644 --- a/gclient_config.py +++ b/gclient_config.py @@ -35,6 +35,11 @@ solutions = [{ 'https://github.com/cpplint/cpplint.git@a33992f68f36fcaa6d0f531a25012a4c474d3542', 'name': 'cpplint' +}, { + 'url': + 'https://github.com/google/yapf.git@32afb3004e0967eab351ee83e3d9d55e3a02fd9b', + 'name': + 'yapf' }, { 'url': 'https://github.com/google/flatbuffers.git@d840856093fa7b935b0d6378c436bd633d006c8c', diff --git a/third_party b/third_party index 310780187..9c512cffb 160000 --- a/third_party +++ b/third_party @@ -1 +1 @@ -Subproject commit 3107801874b4675c02bed0f3297bb4e7fe995642 +Subproject commit 9c512cffb422cbe5cf95e2f6f643cf74fa03d345 diff --git a/tools/format.py b/tools/format.py index 0dc100b9f..5956432dc 100755 --- a/tools/format.py +++ b/tools/format.py @@ -2,6 +2,7 @@ # Copyright 2018 the Deno authors. All rights reserved. MIT license. from glob import glob import os +import sys from third_party import third_party_path, fix_symlinks, google_env, clang_format_path from util import root_path, run, find_exts, platform @@ -26,8 +27,10 @@ for fn in ["BUILD.gn", ".gn"] + find_exts("build_extra", ".gn", ".gni"): # 'third_party/v8/tools/clang', which contains many .py files. # * These third party python files shouldn't be formatted. # * The tools directory has no subdirectories, so `glob()` is sufficient. -# TODO(ry) Install yapf in third_party. -run(["yapf", "-i"] + glob("tools/*.py") + find_exts("build_extra", ".py")) + +run([sys.executable, "third_party/yapf/yapf", "-i"] + glob("tools/*.py") + + find_exts("build_extra", ".py"), + merge_env={"PYTHONPATH": "third_party/yapf"}) # yapf: disable run(["node", prettier, "--write"] + -- cgit v1.2.3