From 724b29d6d489db02bc2049b0638319243674fe05 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 8 Aug 2014 16:41:10 +0800 Subject: [PATCH] win: Fix calling lint scripts with win32 python. --- script/coffeelint.py | 20 +++++++------------- script/cpplint.py | 2 +- script/pylint.py | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/script/coffeelint.py b/script/coffeelint.py index 76a53b42..a62955fa 100755 --- a/script/coffeelint.py +++ b/script/coffeelint.py @@ -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()) diff --git a/script/cpplint.py b/script/cpplint.py index 70b27b92..e5db44d1 100755 --- a/script/cpplint.py +++ b/script/cpplint.py @@ -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(): diff --git a/script/pylint.py b/script/pylint.py index b805abb7..4aba3917 100755 --- a/script/pylint.py +++ b/script/pylint.py @@ -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(): -- 2.43.0