Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: third_party/WebKit/Source/devtools/scripts/local_node/node.py

Issue 2486903002: DevTools: Add support for installing node and running eslint over devtools. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/scripts/local_node/node.py
diff --git a/third_party/WebKit/Source/devtools/scripts/local_node/node.py b/third_party/WebKit/Source/devtools/scripts/local_node/node.py
index 09fd0f2dd14ccc14b02351efa0a2c4ff35b0e840..70735ff5c7c12c4c793461c04f8542d7f4a6a953 100755
--- a/third_party/WebKit/Source/devtools/scripts/local_node/node.py
+++ b/third_party/WebKit/Source/devtools/scripts/local_node/node.py
@@ -15,7 +15,7 @@ THIS_DIR = os.path.dirname(os.path.abspath(__file__))
DEFAULT_VERSION = '4.5.0'
BUCKET = 'chromium-nodejs'
-
+RUNNING_AS_HOOK_FLAG = '--running-as-hook'
def install_latest_node_js(version, tmp_dir):
target_dir = os.path.join(THIS_DIR, 'runtimes', version)
@@ -100,6 +100,12 @@ def install_latest_node_js(version, tmp_dir):
def main(mode=None):
+ # Exit early if this is being invoked from `gclient runhooks`
+ # and INSTALL_NODE_FOR_DEVTOOLS=1 isn't present in the environment.
+ if (RUNNING_AS_HOOK_FLAG in sys.argv[1:] and
+ os.environ.get('INSTALL_NODE_FOR_DEVTOOLS', '0') != '1'):
+ return 0
+
Dirk Pranke 2016/11/11 02:11:20 I'd rewrite this section to use argparse, e.g.:
chenwilliam 2016/12/06 18:22:09 Done.
version = os.environ.get('NODE_VERSION', DEFAULT_VERSION)
try:
tmp_dir = tempfile.mkdtemp(dir=THIS_DIR)
@@ -112,7 +118,8 @@ def main(mode=None):
# TODO(hinoka): How about Windows...?
bin_location = os.path.join(os.path.dirname(bin_location), 'npm')
- return subprocess.call([bin_location, ] + sys.argv[1:])
+ node_args = [arg for arg in sys.argv[1:] if arg != RUNNING_AS_HOOK_FLAG]
+ return subprocess.call([bin_location, ] + node_args)
if __name__ == '__main__':
« testing/buildbot/gn_isolate_map.pyl ('K') | « third_party/WebKit/Source/devtools/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698