blob: 2e26f21990d4ef5ac9fc7d2cacdb7c2dfa6ec921 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
# This program fails if ./tools/format.ts changes any files.
import os
import sys
import util
import sys
import subprocess
from distutils.spawn import find_executable
def lookup_deno_path():
deno_exe = "deno" + util.executable_suffix
release_deno = os.path.join(util.root_path, "target", "release", deno_exe)
debug_deno = os.path.join(util.root_path, "target", "debug", deno_exe)
if os.path.exists(release_deno):
return release_deno
if os.path.exists(debug_deno):
return debug_deno
return find_executable("deno")
def main():
deno_path = lookup_deno_path()
if not deno_path:
print "No available deno executable."
sys.exit(1)
util.run([deno_path, "--allow-read", "--allow-run", "tools/format.ts"])
output = util.run_output(
["git", "status", "-uno", "--porcelain", "--ignore-submodules"])
if len(output) > 0:
print "Run tools/format.ts "
print output
sys.exit(1)
if __name__ == '__main__':
main()
|