mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
tools: remove deps/zlib/GN-scraper.py
Gyp appends search path for `pymod_do_main`, so `GN-scraper.py` in
`v8_gypfiles` always takes precedence over `deps/zlib/GN-scraper.py`,
and `deps/zlib/GN-scraper.py` is never loaded.
PR-URL: https://github.com/nodejs/node/pull/57238
Refs: 46fc91f1fa/pylib/gyp/input.py (L935)
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
a3657da5c6
commit
464485397a
4 changed files with 11 additions and 31 deletions
28
deps/zlib/GN-scraper.py
vendored
28
deps/zlib/GN-scraper.py
vendored
|
@ -1,28 +0,0 @@
|
||||||
# Copyright (c) 2019 Refael Ackeramnn<refack@gmail.com>. All rights reserved.
|
|
||||||
# Use of this source code is governed by an MIT-style license.
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
PLAIN_SOURCE_RE = re.compile('\s*"([^/$].+)"\s*')
|
|
||||||
def DoMain(args):
|
|
||||||
gn_filename, pattern = args
|
|
||||||
src_root = os.path.dirname(gn_filename)
|
|
||||||
with open(gn_filename, 'rb') as gn_file:
|
|
||||||
gn_content = gn_file.read().decode('utf-8')
|
|
||||||
|
|
||||||
scraper_re = re.compile(pattern + r'\[([^\]]+)', re.DOTALL)
|
|
||||||
matches = scraper_re.search(gn_content)
|
|
||||||
match = matches.group(1)
|
|
||||||
files = []
|
|
||||||
for l in match.splitlines():
|
|
||||||
m2 = PLAIN_SOURCE_RE.match(l)
|
|
||||||
if not m2:
|
|
||||||
continue
|
|
||||||
files.append(m2.group(1))
|
|
||||||
# always use `/` since GYP will process paths further downstream
|
|
||||||
rel_files = ['"%s/%s"' % (src_root, f) for f in files]
|
|
||||||
return ' '.join(rel_files)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
print(DoMain(sys.argv[1:]))
|
|
|
@ -14,7 +14,7 @@ echo "Comparing latest upstream with current revision"
|
||||||
|
|
||||||
git fetch https://chromium.googlesource.com/chromium/src/third_party/zlib.git HEAD
|
git fetch https://chromium.googlesource.com/chromium/src/third_party/zlib.git HEAD
|
||||||
|
|
||||||
# Revert zconf.h changes before checking diff
|
# Revert zconf.h changes before checking diff
|
||||||
perl -i -pe 's|^//#include "chromeconf.h"|#include "chromeconf.h"|' "$DEPS_DIR/zlib/zconf.h"
|
perl -i -pe 's|^//#include "chromeconf.h"|#include "chromeconf.h"|' "$DEPS_DIR/zlib/zconf.h"
|
||||||
git stash -- "$DEPS_DIR/zlib/zconf.h"
|
git stash -- "$DEPS_DIR/zlib/zconf.h"
|
||||||
|
|
||||||
|
@ -63,13 +63,13 @@ gzip -dc "$ZLIB_TARBALL" | tar xf - -C zlib/
|
||||||
|
|
||||||
rm "$ZLIB_TARBALL"
|
rm "$ZLIB_TARBALL"
|
||||||
|
|
||||||
cp "$DEPS_DIR/zlib/zlib.gyp" "$DEPS_DIR/zlib/GN-scraper.py" "$DEPS_DIR/zlib/win32/zlib.def" "$DEPS_DIR"
|
cp "$DEPS_DIR/zlib/zlib.gyp" "$DEPS_DIR/zlib/win32/zlib.def" "$DEPS_DIR"
|
||||||
|
|
||||||
rm -rf "$DEPS_DIR/zlib" zlib/.git
|
rm -rf "$DEPS_DIR/zlib" zlib/.git
|
||||||
|
|
||||||
mv zlib "$DEPS_DIR/"
|
mv zlib "$DEPS_DIR/"
|
||||||
|
|
||||||
mv "$DEPS_DIR/zlib.gyp" "$DEPS_DIR/GN-scraper.py" "$DEPS_DIR/zlib/"
|
mv "$DEPS_DIR/zlib.gyp" "$DEPS_DIR/zlib/"
|
||||||
|
|
||||||
mkdir "$DEPS_DIR/zlib/win32"
|
mkdir "$DEPS_DIR/zlib/win32"
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
|
||||||
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
|
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
|
||||||
import gyp
|
import gyp
|
||||||
|
|
||||||
|
# Add search path for `pymod_do_main` first to avoid depending on
|
||||||
|
# load order of gyp files.
|
||||||
|
sys.path.insert(0, os.path.join(node_root, 'tools', 'v8_gypfiles'))
|
||||||
|
|
||||||
# Directory within which we want all generated files (including Makefiles)
|
# Directory within which we want all generated files (including Makefiles)
|
||||||
# to be written.
|
# to be written.
|
||||||
output_dir = os.path.join(os.path.abspath(node_root), 'out')
|
output_dir = os.path.join(os.path.abspath(node_root), 'out')
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# Use of this source code is governed by an MIT-style license.
|
# Use of this source code is governed by an MIT-style license.
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
PLAIN_SOURCE_RE = re.compile(r'\s*"([^/$].+)"\s*')
|
PLAIN_SOURCE_RE = re.compile(r'\s*"([^/$].+)"\s*')
|
||||||
def DoMain(args):
|
def DoMain(args):
|
||||||
|
@ -22,3 +23,6 @@ def DoMain(args):
|
||||||
# always use `/` since GYP will process paths further downstream
|
# always use `/` since GYP will process paths further downstream
|
||||||
rel_files = ['"%s/%s"' % (src_root, f) for f in files]
|
rel_files = ['"%s/%s"' % (src_root, f) for f in files]
|
||||||
return ' '.join(rel_files)
|
return ' '.join(rel_files)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(DoMain(sys.argv[1:]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue