• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright 2016 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import os
7import sys
8
9
10_CATAPULT_PATH = os.path.abspath(
11    os.path.join(os.path.dirname(__file__),
12    os.path.pardir, os.path.pardir, os.path.pardir))
13
14
15_ESLINT_PATH = os.path.abspath(
16    os.path.join(os.path.dirname(__file__), os.path.pardir))
17
18
19def _RunTestsOrDie(top_level_dir):
20  exit_code = run_with_typ.Run(top_level_dir, path=[_ESLINT_PATH])
21  if exit_code:
22    sys.exit(exit_code)
23
24
25def _AddToPathIfNeeded(path):
26  if path not in sys.path:
27    sys.path.insert(0, path)
28
29
30if __name__ == '__main__':
31  _AddToPathIfNeeded(_CATAPULT_PATH)
32
33  from catapult_build import run_with_typ
34
35  _RunTestsOrDie(os.path.join(_ESLINT_PATH, 'eslint'))
36