]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Fix calling lint scripts with win32 python.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 8 Aug 2014 08:41:10 +0000 (16:41 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 8 Aug 2014 08:41:10 +0000 (16:41 +0800)
script/coffeelint.py
script/cpplint.py
script/pylint.py

index 76a53b42325f8a7e06b1d23e5cd57a9a9778be4f..a62955fa81e77b92e8e7255c674e11df75fd847b 100755 (executable)
@@ -3,33 +3,27 @@
 import errno
 import glob
 import os
-import subprocess
 import sys
 
+from lib.util import execute
 
-SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
+
+SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 
 
 def main():
   os.chdir(SOURCE_ROOT)
 
-  coffeelint = os.path.join(SOURCE_ROOT, 'node_modules', 'coffeelint', 'bin',
-                            'coffeelint')
+  coffeelint = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'coffeelint')
+  if sys.platform in ['win32', 'cygwin']:
+    coffeelint += '.cmd'
   settings = ['--quiet', '-f', os.path.join('script', 'coffeelint.json')]
   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')
 
-  try:
-    subprocess.check_call(['node', coffeelint] + settings + files)
-  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
-
+  execute([coffeelint] + settings + files)
 
 if __name__ == '__main__':
   sys.exit(main())
index 70b27b92016ad5f674a2858063dc3c99ebba04e2..e5db44d1dba3c8f7a696df07b604b4e94fdb3055 100755 (executable)
@@ -23,7 +23,7 @@ IGNORE_FILES = [
   os.path.join('atom', 'common', 'swap_or_assign.h'),
 ]
 
-SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
+SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 
 
 def main():
index b805abb72b5873b07c823abe50116cedb2bd86af..4aba3917b84c31c0d5143fcf448501d15c8de2ce 100755 (executable)
@@ -5,7 +5,7 @@ import os
 import subprocess
 import sys
 
-SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
+SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 
 
 def main():