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

Side by Side Diff: third_party/WebKit/Source/devtools/scripts/install_node_deps.py

Issue 2455673003: DevTools: Install local node.js for Mac (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 Ensure node.js and npm modules are installed 8 Ensure node.js and npm modules are installed
9 """ 9 """
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 31
32 def resolve_node_paths(): 32 def resolve_node_paths():
33 if has_valid_global_node(): 33 if has_valid_global_node():
34 return (which('node'), which('npm')) 34 return (which('node'), which('npm'))
35 has_installed_local_node = path.isfile(local_node_binary_path) 35 has_installed_local_node = path.isfile(local_node_binary_path)
36 if has_installed_local_node: 36 if has_installed_local_node:
37 return (local_node_binary_path, local_npm_binary_path) 37 return (local_node_binary_path, local_npm_binary_path)
38 if path.isdir(local_node_runtimes_path): 38 if path.isdir(local_node_runtimes_path):
39 shutil.rmtree(local_node_runtimes_path) 39 shutil.rmtree(local_node_runtimes_path)
40 if sys.platform == 'linux2': 40 if sys.platform == 'linux2' or sys.platform == 'darwin':
41 install_node() 41 install_node()
42 return (local_node_binary_path, local_npm_binary_path) 42 return (local_node_binary_path, local_npm_binary_path)
43 print('ERROR: Please install the latest node.js LTS version using the Mac or Windows installer:') 43 print('ERROR: Please install the latest node.js LTS version using the Window s installer:')
44 print('https://nodejs.org/en/download/') 44 print('https://nodejs.org/en/download/')
45 raise 45 raise
46 46
47 47
48 def has_valid_global_node(): 48 def has_valid_global_node():
49 node_path = which('node') 49 node_path = which('node')
50 if not node_path: 50 if not node_path:
51 return False 51 return False
52 node_process = popen([node_path, '--version']) 52 node_process = popen([node_path, '--version'])
53 (node_process_out, _) = node_process.communicate() 53 (node_process_out, _) = node_process.communicate()
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return None 97 return None
98 98
99 99
100 def popen(arguments, env=None): 100 def popen(arguments, env=None):
101 return subprocess.Popen( 101 return subprocess.Popen(
102 arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) 102 arguments, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
103 103
104 104
105 if __name__ == '__main__': 105 if __name__ == '__main__':
106 sys.exit(main()) 106 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698