tools,bootstrap: preprocess gypi files to json

PR-URL: https://github.com/nodejs/node/pull/19140
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Gus Caplan authored and Myles Borins committed 2018-08-17 15:30:01 -04:00
1 parent 98fe68fbb0
commit 4df93dc8ac
2 files changed
+6 -8

No files matched your search

+1 -8
View File
@@ -109,16 +109,9 @@ function setupMemoryUsage(_memoryUsage) {
function setupConfig(_source) {
// NativeModule._source
// used for `process.config`, but not a real module
var config = _source.config;
const config = _source.config;
delete _source.config;
// strip the gyp comment line at the beginning
config = config.split('\n')
.slice(1)
.join('\n')
.replace(/"/g, '\\"')
.replace(/'/g, '"');
process.config = JSON.parse(config, function(key, value) {
if (value === 'true') return true;
if (value === 'false') return false;
+5
View File
@@ -261,6 +261,11 @@ def JS2C(source, target):
if '/' in name or '\\' in name:
name = '/'.join(re.split('/|\\\\', name)[1:])
# if its a gypi file we're going to want it as json
# later on anyway, so get it out of the way now
if name.endswith(".gypi"):
lines = re.sub(r'#.*?\n', '', lines)
lines = re.sub(r'\'', '"', lines)
name = name.split('.', 1)[0]
var = name.replace('-', '_').replace('/', '_')
key = '%s_key' % var