Skip to content

Commit 4aff056

Browse files
committed
build: reduce one level of spawning in node_gyp
`configure` will now call `node_gyp` as a module instead of forking makes it easier to debug PR-URL: #12653 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 11918c4 commit 4aff056

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

configure

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import nodedownload
4040
# imports in tools/
4141
sys.path.insert(0, os.path.join(root_dir, 'tools'))
4242
import getmoduleversion
43+
from gyp_node import run_gyp
4344

4445
# parse our options
4546
parser = optparse.OptionParser()
@@ -1380,7 +1381,7 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n'
13801381

13811382
write('config.mk', do_not_edit + config)
13821383

1383-
gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel']
1384+
gyp_args = ['--no-parallel']
13841385

13851386
if options.use_xcode:
13861387
gyp_args += ['-f', 'xcode']
@@ -1399,4 +1400,4 @@ gyp_args += args
13991400
if warn.warned:
14001401
warn('warnings were emitted in the configure phase')
14011402

1402-
sys.exit(subprocess.call(gyp_args))
1403+
run_gyp(gyp_args)

tools/gyp_node.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
output_dir = os.path.join(os.path.abspath(node_root), 'out')
1414

1515
def run_gyp(args):
16-
rc = gyp.main(args)
17-
if rc != 0:
18-
print 'Error running GYP'
19-
sys.exit(rc)
20-
21-
if __name__ == '__main__':
22-
args = sys.argv[1:]
23-
2416
# GYP bug.
2517
# On msvs it will crash if it gets an absolute path.
2618
# On Mac/make it will crash if it doesn't get an absolute path.
@@ -63,5 +55,11 @@ def run_gyp(args):
6355
args.append('-Dlinux_use_bundled_gold=0')
6456
args.append('-Dlinux_use_gold_flags=0')
6557

66-
gyp_args = list(args)
67-
run_gyp(gyp_args)
58+
rc = gyp.main(args)
59+
if rc != 0:
60+
print 'Error running GYP'
61+
sys.exit(rc)
62+
63+
64+
if __name__ == '__main__':
65+
run_gyp(sys.argv[1:])

0 commit comments

Comments
 (0)