Skip to content

Commit 23b9ee2

Browse files
committed
Use env_with_node_in_path() and NODE_JS
1 parent c832fff commit 23b9ee2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tools/install.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
import subprocess
1818
import sys
1919

20+
__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21+
sys.path.insert(0, __rootpath__)
22+
23+
from tools import config
24+
from tools import shared
25+
2026
EXCLUDES = [os.path.normpath(x) for x in '''
2127
test/third_party
2228
tools/maint
@@ -86,7 +92,7 @@ def copy_emscripten(target):
8692

8793

8894
def get_npm():
89-
node = os.getenv('EMSDK_NODE')
95+
node = config.NODE_JS[0]
9096
if not node:
9197
return shutil.which('npm')
9298

@@ -96,12 +102,7 @@ def get_npm():
96102

97103

98104
def npm_install(target):
99-
env = os.environ.copy()
100-
# Make sure that Emsdk Node.js is in PATH instead of potentially old system
101-
# Node.js
102-
if os.getenv('EMSDK_NODE'):
103-
env['PATH'] = os.path.dirname(os.getenv('EMSDK_NODE')) + ':' + env['PATH']
104-
subprocess.check_call([get_npm(), 'ci', '--omit=dev'], cwd=target, env=env)
105+
subprocess.check_call([get_npm(), 'ci', '--omit=dev'], cwd=target, env=shared.env_with_node_in_path())
105106

106107

107108
def main():

0 commit comments

Comments
 (0)