Skip to content

Commit efc0f64

Browse files
refackMylesBorins
authored andcommittedAug 16, 2017
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 403c45f commit efc0f64

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()
@@ -1370,7 +1371,7 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n'
13701371

13711372
write('config.mk', do_not_edit + config)
13721373

1373-
gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel']
1374+
gyp_args = ['--no-parallel']
13741375

13751376
if options.use_xcode:
13761377
gyp_args += ['-f', 'xcode']
@@ -1389,4 +1390,4 @@ gyp_args += args
13891390
if warn.warned:
13901391
warn('warnings were emitted in the configure phase')
13911392

1392-
sys.exit(subprocess.call(gyp_args))
1393+
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.
@@ -58,5 +50,11 @@ def run_gyp(args):
5850
args.append('-Dlinux_use_bundled_gold=0')
5951
args.append('-Dlinux_use_gold_flags=0')
6052

61-
gyp_args = list(args)
62-
run_gyp(gyp_args)
53+
rc = gyp.main(args)
54+
if rc != 0:
55+
print 'Error running GYP'
56+
sys.exit(rc)
57+
58+
59+
if __name__ == '__main__':
60+
run_gyp(sys.argv[1:])

0 commit comments

Comments
 (0)
Please sign in to comment.