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') |
Jeff Fisher | a1d0db6 | 2019-02-20 18:56:14 +0000 | [diff] [blame] | 14 | ESLINT_PATH = path.join(THIRD_PARTY_PATH, 'devtools-node-modules', 'third_party', 'node_modules', 'eslint', 'bin', 'eslint.js') |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 +0000 | [diff] [blame] | 15 | |
| 16 | try: |
| 17 | old_sys_path = sys.path[:] |
| 18 | sys.path.append(NODE_PATH) |
| 19 | import node |
| 20 | finally: |
| 21 | sys.path = old_sys_path |
| 22 | |
| 23 | |
| 24 | def node_path(): |
| 25 | return node.GetBinaryPath() |
| 26 | |
| 27 | |
| 28 | def eslint_path(): |
| 29 | return ESLINT_PATH |