2018-10-21 13:43:47 -04:00
|
|
|
#!/usr/bin/env python
|
2019-01-17 15:09:44 -05:00
|
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
|
|
# This program fails if ./tools/format.ts changes any files.
|
2018-10-21 13:43:47 -04:00
|
|
|
|
2019-01-17 15:09:44 -05:00
|
|
|
import os
|
2018-10-21 13:43:47 -04:00
|
|
|
import sys
|
|
|
|
import util
|
|
|
|
import sys
|
|
|
|
import subprocess
|
2019-01-17 15:09:44 -05:00
|
|
|
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")
|
2018-10-21 13:43:47 -04:00
|
|
|
|
|
|
|
|
2018-11-30 03:27:41 -05:00
|
|
|
def main():
|
2019-01-17 15:09:44 -05:00
|
|
|
deno_path = lookup_deno_path()
|
|
|
|
|
|
|
|
if not deno_path:
|
|
|
|
print "No available deno executable."
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
util.run([deno_path, "--allow-run", "tools/format.ts"])
|
2018-10-21 13:43:47 -04:00
|
|
|
output = util.run_output(
|
|
|
|
["git", "status", "-uno", "--porcelain", "--ignore-submodules"])
|
|
|
|
if len(output) > 0:
|
2019-01-17 15:09:44 -05:00
|
|
|
print "Run tools/format.ts "
|
2018-10-21 13:43:47 -04:00
|
|
|
print output
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2018-11-30 03:27:41 -05:00
|
|
|
main()
|