forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Factor out tools/util.py - Move js/*.py to tools. - Rewrite tools/format.sh in python. - Run lint first in travis.
- Loading branch information
Showing
14 changed files
with
123 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# build | ||
/out/ | ||
*.pyc | ||
|
||
# npm deps | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
from glob import glob | ||
from util import run | ||
|
||
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
|
||
os.chdir(root_path) | ||
# TODO(ry) Install clang-format in third_party. | ||
run(["clang-format", "-i", "-style", "Google"] + glob("src/*.cc") + | ||
glob("src/*.h")) | ||
for fn in ["BUILD.gn", ".gn"] + glob("build_extra/**/*.gn*"): | ||
run(["gn", "format", fn]) | ||
# TODO(ry) Install yapf in third_party. | ||
run(["yapf", "-i"] + glob("tools/*.py")) | ||
# TODO(ry) Install prettier in third_party. | ||
run([ | ||
"prettier", "--write", "js/deno.d.ts", "js/main.ts", "js/mock_runtime.js", | ||
"tsconfig.json" | ||
]) | ||
# Do not format these. | ||
# js/msg_generated.ts | ||
# js/flatbuffers.js | ||
run(["rustfmt", "--write-mode", "overwrite"] + glob("src/*.rs")) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python | ||
""" | ||
gn can only run python scripts. This launches a subprocess Node process. | ||
The working dir of this program is out/Debug/ (AKA root_build_dir) | ||
Before running node, we symlink js/node_modules to out/Debug/node_modules. | ||
""" | ||
import subprocess | ||
import sys | ||
import os | ||
import util | ||
|
||
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
tools_path = os.path.join(root_path, "tools") | ||
third_party_path = os.path.join(root_path, "third_party") | ||
target_abs = os.path.join(third_party_path, "node_modules") | ||
target_rel = os.path.relpath(target_abs) | ||
|
||
util.remove_and_symlink(target_rel, "node_modules", True) | ||
util.run(["node"] + sys.argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2018 Ryan Dahl <[email protected]> | ||
# All rights reserved. MIT License. | ||
import os | ||
import subprocess | ||
|
||
|
||
def run(args): | ||
print " ".join(args) | ||
env = os.environ.copy() | ||
subprocess.check_call(args, env=env) | ||
|
||
|
||
def remove_and_symlink(target, name, target_is_dir=False): | ||
try: | ||
os.unlink(name) | ||
except: | ||
pass | ||
symlink(target, name, target_is_dir) | ||
|
||
|
||
def symlink(target, name, target_is_dir=False): | ||
if os.name == "nt": | ||
import ctypes | ||
CreateSymbolicLinkW = ctypes.windll.kernel32.CreateSymbolicLinkW | ||
CreateSymbolicLinkW.restype = ctypes.c_ubyte | ||
CreateSymbolicLinkW.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, | ||
ctypes.c_uint32) | ||
|
||
flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE | ||
if (target_is_dir): | ||
flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY | ||
if not CreateSymbolicLinkW(name, target, flags): | ||
raise ctypes.WinError() | ||
else: | ||
os.symlink(target, name) | ||
|
||
|
||
def touch(fname): | ||
if os.path.exists(fname): | ||
os.utime(fname, None) | ||
else: | ||
open(fname, 'a').close() |