Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 +0000 | [diff] [blame] | 1 | # Copyright 2017 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 | """ |
| 5 | Thin wrapper around the local node.js installed as part of chromium DEPS |
| 6 | """ |
| 7 | |
| 8 | from os import path |
| 9 | import sys |
| 10 | |
| 11 | SCRIPTS_PATH = path.dirname(path.abspath(__file__)) |
| 12 | THIRD_PARTY_PATH = path.join(SCRIPTS_PATH, '..', '..', '..', '..') |
| 13 | NODE_PATH = path.join(THIRD_PARTY_PATH, 'node') |
| 14 | ESLINT_PATH = path.join(THIRD_PARTY_PATH, 'devtools-node-modules', 'third_party', |
| 15 | 'node_modules', '.bin', 'eslint') |
| 16 | |
| 17 | try: |
| 18 | old_sys_path = sys.path[:] |
| 19 | sys.path.append(NODE_PATH) |
| 20 | import node |
| 21 | finally: |
| 22 | sys.path = old_sys_path |
| 23 | |
| 24 | |
| 25 | def node_path(): |
| 26 | return node.GetBinaryPath() |
| 27 | |
| 28 | |
| 29 | def eslint_path(): |
| 30 | return ESLINT_PATH |