Skip to content

Commit 0736dd8

Browse files
committed
build: don't pass python override to V8 build
If the `configure.py` script is executed by a Python binary that is not the one on the PATH it will create a `python` symlink in `out/tools/bin` and prefix that to the PATH so it is used instead of the one that otherwise would have been found on the PATH. This is done so that gyp scripts shelling out to `python` execute with the same version of Python as used to run the configure script. V8's build uses V8's build toolchain (i.e. not gyp) and currently that is incompatible with Python 3. Prevent prefixing the PATH for the V8 build so that it picks up `python` from the unprefixed PATH. This will allow us to build Node.js with Python 3 but still use Python 2 to build V8 in the CI. PR-URL: #38969 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 660a97b commit 0736dd8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ V8_TEST_OPTIONS = $(V8_EXTRA_TEST_OPTIONS)
3535
ifdef DISABLE_V8_I18N
3636
V8_BUILD_OPTIONS += i18nsupport=off
3737
endif
38+
# V8 build and test toolchains are not currently compatible with Python 3.
39+
# config.mk may have prepended a symlink for `python` to PATH which we need
40+
# to undo before calling V8's tools.
41+
OVERRIDE_BIN_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))out/tools/bin
42+
NO_BIN_OVERRIDE_PATH=$(subst $() $(),:,$(filter-out $(OVERRIDE_BIN_DIR),$(subst :, ,$(PATH))))
3843

3944
ifeq ($(OSTYPE), darwin)
4045
GCOV = xcrun llvm-cov gcov
@@ -273,7 +278,8 @@ endif
273278
# Rebuilds deps/v8 as a git tree, pulls its third-party dependencies, and
274279
# builds it.
275280
v8:
276-
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
281+
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
282+
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
277283

278284
.PHONY: jstest
279285
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
@@ -649,19 +655,22 @@ test-with-async-hooks:
649655
ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
650656
# Related CI job: node-test-commit-v8-linux
651657
test-v8: v8 ## Runs the V8 test suite on deps/v8.
652-
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) $(V8_TEST_OPTIONS) \
658+
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
659+
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) $(V8_TEST_OPTIONS) \
653660
mjsunit cctest debugger inspector message preparser \
654661
$(TAP_V8)
655662
$(info Testing hash seed)
656663
$(MAKE) test-hash-seed
657664

658665
test-v8-intl: v8
659-
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) \
666+
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
667+
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) \
660668
--mode=$(BUILDTYPE_LOWER) intl \
661669
$(TAP_V8_INTL)
662670

663671
test-v8-benchmarks: v8
664-
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
672+
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
673+
deps/v8/tools/run-tests.py --gn --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
665674
benchmarks \
666675
$(TAP_V8_BENCHMARKS)
667676

0 commit comments

Comments
 (0)