]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-84461: Add HOSTRUNNER for program to run Python executable (GH-91931)
authorEthan Smith <ethan@ethanhs.me>
Thu, 28 Apr 2022 12:14:19 +0000 (05:14 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Apr 2022 12:14:19 +0000 (05:14 -0700)
`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

Makefile.pre.in
configure
configure.ac

index f3bccf4fec7ec8f5e60baf4fe6cfaf3ea360d6bf..c12305aed6a11822c3eef4577307387ebbbac0ea 100644 (file)
@@ -285,6 +285,8 @@ LIBOBJS=    @LIBOBJS@
 PYTHON=                python$(EXE)
 BUILDPYTHON=   python$(BUILDEXE)
 
+HOSTRUNNER= @HOSTRUNNER@
+
 PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
 UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
@@ -1350,7 +1352,7 @@ regen-keyword:
        $(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
 
 .PHONY: regen-stdlib-module-names
-regen-stdlib-module-names: build_all Programs/_testembed
+regen-stdlib-module-names: all Programs/_testembed
        # Regenerate Python/stdlib_module_names.h
        # using Tools/scripts/generate_stdlib_module_names.py
        $(RUNSHARED) ./$(BUILDPYTHON) \
@@ -1648,7 +1650,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
 ######################################################################
 
 TESTOPTS=      $(EXTRATESTOPTS)
-TESTPYTHON=    $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
+TESTPYTHON=    $(RUNSHARED) $(PYTHON_FOR_BUILD) $(TESTPYTHONOPTS)
 TESTRUNNER=    $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py
 TESTTIMEOUT=   1200
 
@@ -1656,7 +1658,7 @@ TESTTIMEOUT=      1200
 
 # Remove "test_python_*" directories of previous failed test jobs.
 # Pass TESTOPTS options because it can contain --tempdir option.
-cleantest: build_all
+cleantest: all
        $(TESTRUNNER) $(TESTOPTS) --cleanup
 
 # Run a basic set of regression tests.
@@ -1691,14 +1693,14 @@ testuniversal:  @DEF_MAKE_RULE@ platform
 
 # Like testall, but with only one pass and without multiple processes.
 # Run an optional script to include information about the build environment.
-buildbottest:  build_all platform
+buildbottest:  all platform
                -@if which pybuildbot.identify >/dev/null 2>&1; then \
                        pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
                fi
                $(TESTRUNNER) -j 1 -u all -W --slowest --fail-env-changed --timeout=$(TESTTIMEOUT) $(TESTOPTS)
 
-pythoninfo: build_all
-               $(RUNSHARED) ./$(BUILDPYTHON) -m test.pythoninfo
+pythoninfo: all
+               $(RUNSHARED) $(HOSTRUNNER) ./$(BUILDPYTHON) -m test.pythoninfo
 
 QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
                test_multibytecodec test_urllib2_localnet test_itertools \
@@ -1711,10 +1713,10 @@ quicktest:      @DEF_MAKE_RULE@ platform
 
 # SSL tests
 .PHONY: multisslcompile multissltest
-multisslcompile: build_all
+multisslcompile: all
        $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py --steps=modules
 
-multissltest: build_all
+multissltest: all
        $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py
 
 install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
@@ -1986,7 +1988,7 @@ TESTSUBDIRS=      ctypes/test \
                unittest/test unittest/test/testmock
 
 TEST_MODULES=@TEST_MODULES@
-libinstall:    build_all $(srcdir)/Modules/xxmodule.c
+libinstall:    all $(srcdir)/Modules/xxmodule.c
        @for i in $(SCRIPTDIR) $(LIBDEST); \
        do \
                if test ! -d $(DESTDIR)$$i; then \
index f161e4ebed94b61bd587bc28f01e2ac2055651ee..2c47a1e85c14525aaf9f841e504635c4e4095de5 100755 (executable)
--- a/configure
+++ b/configure
@@ -888,6 +888,7 @@ AR
 LINK_PYTHON_OBJS
 LINK_PYTHON_DEPS
 LIBRARY_DEPS
+HOSTRUNNER
 STATIC_LIBPYTHON
 GNULD
 EXPORTSFROM
@@ -1076,6 +1077,7 @@ LDFLAGS
 LIBS
 CPPFLAGS
 CPP
+HOSTRUNNER
 PROFILE_TASK
 LIBUUID_CFLAGS
 LIBUUID_LIBS
@@ -1878,6 +1880,7 @@ Some influential environment variables:
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  HOSTRUNNER  Program to run CPython for the host platform
   PROFILE_TASK
               Python args for PGO generation task
   LIBUUID_CFLAGS
@@ -6671,6 +6674,33 @@ if test "$cross_compiling" = yes; then
        RUNSHARED=
 fi
 
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking HOSTRUNNER" >&5
+$as_echo_n "checking HOSTRUNNER... " >&6; }
+if test -z "$HOSTRUNNER"
+then
+  case $ac_sys_system/$ac_sys_emscripten_target in #(
+  Emscripten/node*) :
+
+      if test "x$enable_wasm_pthreads" = xyes; then :
+
+        HOSTRUNNER='node --experimental-wasm-threads --experimental-wasm-bulk-memory'
+
+else
+
+        HOSTRUNNER='node'
+
+fi
+     ;; #(
+  *) :
+    HOSTRUNNER=''
+   ;;
+esac
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTRUNNER" >&5
+$as_echo "$HOSTRUNNER" >&6; }
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDLIBRARY" >&5
 $as_echo "$LDLIBRARY" >&6; }
 
index 86839547e26835216b8f657006ffbfda60901fab..62da321a98af188fc5bbf8896b33b0f7260a8255 100644 (file)
@@ -1412,6 +1412,24 @@ if test "$cross_compiling" = yes; then
        RUNSHARED=
 fi
 
+AC_ARG_VAR([HOSTRUNNER], [Program to run CPython for the host platform])
+AC_MSG_CHECKING([HOSTRUNNER])
+if test -z "$HOSTRUNNER"
+then
+  AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
+    [Emscripten/node*], [
+      AS_VAR_IF([enable_wasm_pthreads], [yes], [
+        HOSTRUNNER='node --experimental-wasm-threads --experimental-wasm-bulk-memory'
+      ], [
+        HOSTRUNNER='node'
+      ])
+    ],
+    [HOSTRUNNER='']
+  )
+fi
+AC_SUBST([HOSTRUNNER])
+AC_MSG_RESULT([$HOSTRUNNER])
+
 AC_MSG_RESULT($LDLIBRARY)
 
 # LIBRARY_DEPS, LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variable