summaryrefslogtreecommitdiff
path: root/tools/format.py
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-07-25 10:17:44 +0200
committerBert Belder <bertbelder@gmail.com>2018-07-25 20:13:17 +0200
commit4d08bb85a4276292c2121b221b4840865a13cd42 (patch)
treed7da20a39432ddcfb9e43c4e1ad010d8db310230 /tools/format.py
parent0875411267d62a0fdcaf762657f19082b440fe36 (diff)
Clean up and fix tools
* Make sync_third_party work in general * Un-break build.py and run_hooks.py on windows * Partially fix format.py on windows * Reduce code duplication between run_hooks and sync_third_party
Diffstat (limited to 'tools/format.py')
-rwxr-xr-xtools/format.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/format.py b/tools/format.py
index b994535f7..2bbc95bed 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python
import os
-from util import run, find_exts
+from third_party import third_party_path, fix_symlinks, google_env
+from util import root_path, run, find_exts
+
+fix_symlinks()
-root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-third_party_path = os.path.join(root_path, "third_party")
prettier = os.path.join(third_party_path, "node_modules", "prettier",
"bin-prettier.js")
tools_path = os.path.join(root_path, "tools")
@@ -15,7 +16,7 @@ os.chdir(root_path)
run(["clang-format", "-i", "-style", "Google"] + find_exts("src", ".cc", ".h"))
for fn in ["BUILD.gn", ".gn"] + find_exts("build_extra", ".gn", ".gni"):
- run(["third_party/depot_tools/gn", "format", fn])
+ run(["third_party/depot_tools/gn", "format", fn], env=google_env())
# TODO(ry) Install yapf in third_party.
run(["yapf", "-i"] + find_exts("tools/", ".py") +