electron/script/coffeelint.py

36 lines
984 B
Python
Raw Normal View History

2013-09-27 02:49:55 +00:00
#!/usr/bin/env python
2014-03-03 12:03:25 +00:00
import errno
2013-09-27 02:49:55 +00:00
import glob
import os
import subprocess
import sys
SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
def main():
os.chdir(SOURCE_ROOT)
coffeelint = os.path.join(SOURCE_ROOT, 'node_modules', 'coffeelint', 'bin',
'coffeelint')
settings = ['--quiet', '-f', os.path.join('script', 'coffeelint.json')]
2014-03-16 01:43:19 +00:00
files = glob.glob('atom/browser/api/lib/*.coffee') + \
glob.glob('atom/renderer/api/lib/*.coffee') + \
glob.glob('atom/common/api/lib/*.coffee') + \
glob.glob('atom/browser/atom/*.coffee')
2013-09-27 02:49:55 +00:00
2014-03-03 11:50:32 +00:00
try:
subprocess.check_call(['node', coffeelint] + settings + files)
2014-03-03 11:50:32 +00:00
except OSError as e:
if e.errno == errno.ENOENT and sys.platform in ['win32', 'cygwin']:
subprocess.check_call(['node', coffeelint] + settings + files,
executable='C:/Program Files/nodejs/node.exe')
else:
raise
2013-09-27 02:49:55 +00:00
if __name__ == '__main__':
sys.exit(main())