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: https://github.com/nodejs/node/pull/12653
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
Refael Ackermann 2017-04-25 17:36:50 -04:00
Родитель 11918c4aed
Коммит 4aff0563aa
2 изменённых файлов: 11 добавлений и 12 удалений

5
configure поставляемый
Просмотреть файл

@ -40,6 +40,7 @@ import nodedownload
# imports in tools/ # imports in tools/
sys.path.insert(0, os.path.join(root_dir, 'tools')) sys.path.insert(0, os.path.join(root_dir, 'tools'))
import getmoduleversion import getmoduleversion
from gyp_node import run_gyp
# parse our options # parse our options
parser = optparse.OptionParser() parser = optparse.OptionParser()
@ -1380,7 +1381,7 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n'
write('config.mk', do_not_edit + config) write('config.mk', do_not_edit + config)
gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel'] gyp_args = ['--no-parallel']
if options.use_xcode: if options.use_xcode:
gyp_args += ['-f', 'xcode'] gyp_args += ['-f', 'xcode']
@ -1399,4 +1400,4 @@ gyp_args += args
if warn.warned: if warn.warned:
warn('warnings were emitted in the configure phase') warn('warnings were emitted in the configure phase')
sys.exit(subprocess.call(gyp_args)) run_gyp(gyp_args)

Просмотреть файл

@ -13,14 +13,6 @@ import gyp
output_dir = os.path.join(os.path.abspath(node_root), 'out') output_dir = os.path.join(os.path.abspath(node_root), 'out')
def run_gyp(args): def run_gyp(args):
rc = gyp.main(args)
if rc != 0:
print 'Error running GYP'
sys.exit(rc)
if __name__ == '__main__':
args = sys.argv[1:]
# GYP bug. # GYP bug.
# On msvs it will crash if it gets an absolute path. # On msvs it will crash if it gets an absolute path.
# On Mac/make it will crash if it doesn't get an absolute path. # On Mac/make it will crash if it doesn't get an absolute path.
@ -63,5 +55,11 @@ if __name__ == '__main__':
args.append('-Dlinux_use_bundled_gold=0') args.append('-Dlinux_use_bundled_gold=0')
args.append('-Dlinux_use_gold_flags=0') args.append('-Dlinux_use_gold_flags=0')
gyp_args = list(args) rc = gyp.main(args)
run_gyp(gyp_args) if rc != 0:
print 'Error running GYP'
sys.exit(rc)
if __name__ == '__main__':
run_gyp(sys.argv[1:])