Skip to content

Commit d1de107

Browse files
authored
gh-84461: Add HOSTRUNNER for program to run Python executable (GH-91931)
`HOSTRUNNER` is a program which can be used to run `BUILDPYTHON` for the host platform (for example, `python.js` requires `node`). Also change depedencies from `build_all` to `all` so that targets which can't build everything (e.g. WASM) can still run `buildbottest` and `pythoninfo`. cc @tiran
1 parent 87c6cf9 commit d1de107

File tree

3 files changed

+59
-9
lines changed

3 files changed

+59
-9
lines changed

Makefile.pre.in

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ LIBOBJS= @LIBOBJS@
285285
PYTHON= python$(EXE)
286286
BUILDPYTHON= python$(BUILDEXE)
287287

288+
HOSTRUNNER= @HOSTRUNNER@
289+
288290
PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
289291
UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
290292
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
@@ -1350,7 +1352,7 @@ regen-keyword:
13501352
$(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
13511353

13521354
.PHONY: regen-stdlib-module-names
1353-
regen-stdlib-module-names: build_all Programs/_testembed
1355+
regen-stdlib-module-names: all Programs/_testembed
13541356
# Regenerate Python/stdlib_module_names.h
13551357
# using Tools/scripts/generate_stdlib_module_names.py
13561358
$(RUNSHARED) ./$(BUILDPYTHON) \
@@ -1648,15 +1650,15 @@ $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
16481650
######################################################################
16491651

16501652
TESTOPTS= $(EXTRATESTOPTS)
1651-
TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
1653+
TESTPYTHON= $(RUNSHARED) $(PYTHON_FOR_BUILD) $(TESTPYTHONOPTS)
16521654
TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py
16531655
TESTTIMEOUT= 1200
16541656

16551657
.PHONY: test testall testuniversal buildbottest pythoninfo
16561658

16571659
# Remove "test_python_*" directories of previous failed test jobs.
16581660
# Pass TESTOPTS options because it can contain --tempdir option.
1659-
cleantest: build_all
1661+
cleantest: all
16601662
$(TESTRUNNER) $(TESTOPTS) --cleanup
16611663

16621664
# Run a basic set of regression tests.
@@ -1691,14 +1693,14 @@ testuniversal: @DEF_MAKE_RULE@ platform
16911693

16921694
# Like testall, but with only one pass and without multiple processes.
16931695
# Run an optional script to include information about the build environment.
1694-
buildbottest: build_all platform
1696+
buildbottest: all platform
16951697
-@if which pybuildbot.identify >/dev/null 2>&1; then \
16961698
pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
16971699
fi
16981700
$(TESTRUNNER) -j 1 -u all -W --slowest --fail-env-changed --timeout=$(TESTTIMEOUT) $(TESTOPTS)
16991701

1700-
pythoninfo: build_all
1701-
$(RUNSHARED) ./$(BUILDPYTHON) -m test.pythoninfo
1702+
pythoninfo: all
1703+
$(RUNSHARED) $(HOSTRUNNER) ./$(BUILDPYTHON) -m test.pythoninfo
17021704

17031705
QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
17041706
test_multibytecodec test_urllib2_localnet test_itertools \
@@ -1711,10 +1713,10 @@ quicktest: @DEF_MAKE_RULE@ platform
17111713

17121714
# SSL tests
17131715
.PHONY: multisslcompile multissltest
1714-
multisslcompile: build_all
1716+
multisslcompile: all
17151717
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py --steps=modules
17161718

1717-
multissltest: build_all
1719+
multissltest: all
17181720
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py
17191721

17201722
install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
@@ -1986,7 +1988,7 @@ TESTSUBDIRS= ctypes/test \
19861988
unittest/test unittest/test/testmock
19871989

19881990
TEST_MODULES=@TEST_MODULES@
1989-
libinstall: build_all $(srcdir)/Modules/xxmodule.c
1991+
libinstall: all $(srcdir)/Modules/xxmodule.c
19901992
@for i in $(SCRIPTDIR) $(LIBDEST); \
19911993
do \
19921994
if test ! -d $(DESTDIR)$$i; then \

configure

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,24 @@ if test "$cross_compiling" = yes; then
14121412
RUNSHARED=
14131413
fi
14141414

1415+
AC_ARG_VAR([HOSTRUNNER], [Program to run CPython for the host platform])
1416+
AC_MSG_CHECKING([HOSTRUNNER])
1417+
if test -z "$HOSTRUNNER"
1418+
then
1419+
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
1420+
[Emscripten/node*], [
1421+
AS_VAR_IF([enable_wasm_pthreads], [yes], [
1422+
HOSTRUNNER='node --experimental-wasm-threads --experimental-wasm-bulk-memory'
1423+
], [
1424+
HOSTRUNNER='node'
1425+
])
1426+
],
1427+
[HOSTRUNNER='']
1428+
)
1429+
fi
1430+
AC_SUBST([HOSTRUNNER])
1431+
AC_MSG_RESULT([$HOSTRUNNER])
1432+
14151433
AC_MSG_RESULT($LDLIBRARY)
14161434

14171435
# LIBRARY_DEPS, LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variable

0 commit comments

Comments
 (0)