1# Copyright (c) 2015 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import os 6import sys 7 8from tracing import tracing_project 9 10 11def Main(paths_to_lint): 12 project = tracing_project.TracingProject() 13 new_paths = [ 14 os.path.abspath(os.path.join( 15 project.tracing_third_party_path, 'python_gflags')), 16 os.path.abspath(os.path.join( 17 project.tracing_third_party_path, 'closure_linter')) 18 ] 19 sys.path += new_paths 20 try: 21 _MainImpl(paths_to_lint) 22 finally: 23 for p in new_paths: 24 sys.path.remove(p) 25 26 27def _MainImpl(paths_to_lint): 28 from closure_linter import gjslint 29 30 if sys.argv[1:] == ['--help']: 31 sys.exit(gjslint.main()) 32 33 if len(sys.argv) > 1: 34 sys.stderr.write('No arguments allowed') 35 sys.exit(1) 36 37 sys.argv.append('--strict') 38 sys.argv.append('--unix_mode') 39 sys.argv.append('--check_html') 40 for p in paths_to_lint: 41 sys.argv.extend(['-r', os.path.relpath(p)]) 42 43 gjslint.main() 44