third_party: install yapf with pip

This commit is contained in:
Bert Belder 2018-10-23 16:51:54 +02:00
parent 4ceb205512
commit 0dda87f962
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
4 changed files with 15 additions and 11 deletions

View file

@ -35,11 +35,6 @@ solutions = [{
'https://github.com/cpplint/cpplint.git@a33992f68f36fcaa6d0f531a25012a4c474d3542', 'https://github.com/cpplint/cpplint.git@a33992f68f36fcaa6d0f531a25012a4c474d3542',
'name': 'name':
'cpplint' 'cpplint'
}, {
'url':
'https://github.com/google/yapf.git@32afb3004e0967eab351ee83e3d9d55e3a02fd9b',
'name':
'yapf'
}, { }, {
'url': 'url':
'https://github.com/google/flatbuffers.git@d840856093fa7b935b0d6378c436bd633d006c8c', 'https://github.com/google/flatbuffers.git@d840856093fa7b935b0d6378c436bd633d006c8c',

@ -1 +1 @@
Subproject commit 0da585d1d855ad720b7e5a5a0d0af380e66216f3 Subproject commit 739aa43d724ecf1b0ecce7dac0b2c1f1ae098bbd

View file

@ -3,7 +3,8 @@
from glob import glob from glob import glob
import os import os
import sys 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 from util import root_path, run, find_exts, platform
fix_symlinks() 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. # 'third_party/v8/tools/clang', which contains many .py files.
# * These third party python files shouldn't be formatted. # * These third party python files shouldn't be formatted.
# * The tools directory has no subdirectories, so `glob()` is sufficient. # * The tools directory has no subdirectories, so `glob()` is sufficient.
# TODO(ry) Install yapf in third_party.
run([sys.executable, "third_party/yapf/yapf", "-i"] + glob("tools/*.py") + run([sys.executable, "third_party/python_packages/bin/yapf", "-i"] +
find_exts("build_extra", ".py"), glob("tools/*.py") + find_exts("build_extra", ".py"),
merge_env={"PYTHONPATH": "third_party/yapf"}) env=python_env())
# yapf: disable # yapf: disable
run(["node", prettier, "--write"] + run(["node", prettier, "--write"] +

View file

@ -160,6 +160,14 @@ def run_pip():
cwd=third_party_path, cwd=third_party_path,
merge_env=pip_env) 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. # Remove the temporary pip installation.
rmtree(temp_python_home) rmtree(temp_python_home)