summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/chromeos/braille_ime/PRESUBMIT.py
blob: 368c96fc58a4ad248593ae812e980c4638bc6f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Presubmit script for the Braille IME."""

def CheckChangeOnUpload(input_api, output_api):
  def FileFilter(path):
    return path.endswith('.js') or path.endswith('check_braille_ime.py')
  if not any((FileFilter(p) for p in input_api.LocalPaths())):
    return []
  import sys
  if not sys.platform.startswith('linux'):
    return []
  sys.path.insert(0, input_api.PresubmitLocalPath())
  try:
    from check_braille_ime import CheckBrailleIme
  finally:
    sys.path.pop(0)
  success, output = CheckBrailleIme()
  if not success:
    return [output_api.PresubmitError(
        'Braille IME closure compilation failed',
        long_text=output)]
  return []