summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-10-23 16:51:54 +0200
committerBert Belder <bertbelder@gmail.com>2018-10-23 16:51:54 +0200
commit0dda87f962b2209be1734f4fe6bb1ba9f6c0e66b (patch)
treead26dcf0f72d257bb147320c4f6029a019e2a456 /tools
parent4ceb205512bbeb760c219306d6df7d6c1f12aa19 (diff)
third_party: install yapf with pip
Diffstat (limited to 'tools')
-rwxr-xr-xtools/format.py11
-rw-r--r--tools/third_party.py8
2 files changed, 14 insertions, 5 deletions
diff --git a/tools/format.py b/tools/format.py
index 5956432dc..a1217a49d 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -3,7 +3,8 @@
from glob import glob
import os
import sys
-from third_party import third_party_path, fix_symlinks, google_env, clang_format_path
+from third_party import fix_symlinks, google_env, python_env
+from third_party import clang_format_path, third_party_path
from util import root_path, run, find_exts, platform
fix_symlinks()
@@ -27,10 +28,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.
-
-run([sys.executable, "third_party/yapf/yapf", "-i"] + glob("tools/*.py") +
- find_exts("build_extra", ".py"),
- merge_env={"PYTHONPATH": "third_party/yapf"})
+# TODO(ry) Install yapf in third_party.
+run([sys.executable, "third_party/python_packages/bin/yapf", "-i"] +
+ glob("tools/*.py") + find_exts("build_extra", ".py"),
+ env=python_env())
# yapf: disable
run(["node", prettier, "--write"] +
diff --git a/tools/third_party.py b/tools/third_party.py
index 0477187c0..2e7de23b4 100644
--- a/tools/third_party.py
+++ b/tools/third_party.py
@@ -160,6 +160,14 @@ def run_pip():
cwd=third_party_path,
merge_env=pip_env)
+ # Get yapf.
+ # Install pywin32.
+ run([
+ sys.executable, "-m", "pip", "install", "--upgrade", "--target",
+ python_packages_path, "yapf"
+ ],
+ cwd=third_party_path,
+ merge_env=pip_env)
# Remove the temporary pip installation.
rmtree(temp_python_home)