bpo-27640: Add --disable-test-modules configure option (GH-23886)

Added --disable-test-modules option to the configure script:
don't build nor install test modules.

Patch by Xavier de Gaye, Thomas Petazzoni and Peixing Xin.

Co-Authored-By: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Co-Authored-By: Xavier de Gaye <xdegaye@gmail.com>
This commit is contained in:
pxinwr 2020-12-30 20:50:39 +08:00 committed by GitHub
parent c56387f80c
commit 277ce3060b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 117 additions and 42 deletions

View File

@ -558,6 +558,10 @@ Build Changes
* The :mod:`atexit` module must now always be built as a built-in module. * The :mod:`atexit` module must now always be built as a built-in module.
(Contributed by Victor Stinner in :issue:`42639`.) (Contributed by Victor Stinner in :issue:`42639`.)
* Added ``--disable-test-modules`` option to the ``configure`` script:
don't build nor install test modules.
(Contributed by Xavier de Gaye, Thomas Petazzoni and Peixing Xin in :issue:`27640`.)
C API Changes C API Changes
============= =============

View File

@ -1366,18 +1366,54 @@ maninstall: altmaninstall
# Install the library # Install the library
XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ LIBSUBDIRS= asyncio \
tkinter/test/test_ttk site-packages test \ collections \
test/audiodata \ concurrent concurrent/futures \
test/capath test/data \ csv \
test/cjkencodings test/decimaltestdata \ ctypes ctypes/macholib \
test/xmltestdata test/xmltestdata/c14n-20 \ curses \
test/dtracedata \ dbm \
test/eintrdata \ distutils distutils/command \
test/imghdrdata \ email email/mime \
test/libregrtest \ encodings \
test/subprocessdata test/sndhdrdata test/support \ ensurepip ensurepip/_bundled \
test/tracedmodules test/encoded_modules \ html \
http \
idlelib idlelib/Icons \
importlib importlib/metadata \
json \
lib2to3 lib2to3/fixes lib2to3/pgen2 \
logging \
multiprocessing multiprocessing/dummy \
pydoc_data \
site-packages \
sqlite3 \
tkinter \
turtledemo \
unittest \
urllib \
venv venv/scripts venv/scripts/common venv/scripts/posix \
wsgiref \
$(XMLLIBSUBDIRS) \
xmlrpc \
zoneinfo
TESTSUBDIRS= ctypes/test \
distutils/tests \
idlelib/idle_test \
lib2to3/tests \
lib2to3/tests/data \
lib2to3/tests/data/fixers \
lib2to3/tests/data/fixers/myfixes \
sqlite3/test \
test test/audiodata \
test/capath test/cjkencodings \
test/data test/decimaltestdata \
test/dtracedata test/eintrdata \
test/encoded_modules test/imghdrdata \
test/libregrtest test/sndhdrdata \
test/subprocessdata test/support \
test/test_asyncio \
test/test_email test/test_email/data \
test/test_import \ test/test_import \
test/test_import/data \ test/test_import/data \
test/test_import/data/circular_imports \ test/test_import/data/circular_imports \
@ -1385,8 +1421,6 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
test/test_import/data/package \ test/test_import/data/package \
test/test_import/data/package2 \ test/test_import/data/package2 \
test/test_import/data/unwritable \ test/test_import/data/unwritable \
importlib \
importlib/metadata \
test/test_importlib \ test/test_importlib \
test/test_importlib/builtin \ test/test_importlib/builtin \
test/test_importlib/data \ test/test_importlib/data \
@ -1425,30 +1459,19 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
test/test_importlib/source \ test/test_importlib/source \
test/test_importlib/zipdata01 \ test/test_importlib/zipdata01 \
test/test_importlib/zipdata02 \ test/test_importlib/zipdata02 \
test/test_zoneinfo test/test_zoneinfo/data \ test/test_json \
test/ziptestdata \
asyncio \
test/test_asyncio \
collections concurrent concurrent/futures encodings \
email email/mime test/test_email test/test_email/data \
ensurepip ensurepip/_bundled \
html json test/test_json http dbm xmlrpc \
sqlite3 sqlite3/test \
logging csv wsgiref urllib \
lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
lib2to3/tests/data lib2to3/tests/data/fixers \
lib2to3/tests/data/fixers/myfixes \
ctypes ctypes/test ctypes/macholib \
idlelib idlelib/Icons idlelib/idle_test \
distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
test/test_peg_generator \ test/test_peg_generator \
test/test_tools test/test_warnings test/test_warnings/data \ test/test_tools \
turtledemo \ test/test_warnings test/test_warnings/data \
multiprocessing multiprocessing/dummy \ test/test_zoneinfo test/test_zoneinfo/data \
unittest unittest/test unittest/test/testmock \ test/tracedmodules \
venv venv/scripts venv/scripts/common venv/scripts/posix \ test/xmltestdata test/xmltestdata/c14n-20 \
curses pydoc_data \ test/ziptestdata \
zoneinfo tkinter/test tkinter/test/test_tkinter \
tkinter/test/test_ttk \
unittest/test unittest/test/testmock
TEST_MODULES=@TEST_MODULES@
libinstall: build_all $(srcdir)/Modules/xxmodule.c libinstall: build_all $(srcdir)/Modules/xxmodule.c
@for i in $(SCRIPTDIR) $(LIBDEST); \ @for i in $(SCRIPTDIR) $(LIBDEST); \
do \ do \
@ -1458,7 +1481,12 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
else true; \ else true; \
fi; \ fi; \
done done
@for d in $(LIBSUBDIRS); \ @if test "$(TEST_MODULES)" = yes; then \
subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
else \
subdirs="$(LIBSUBDIRS)"; \
fi; \
for d in $$subdirs; \
do \ do \
a=$(srcdir)/Lib/$$d; \ a=$(srcdir)/Lib/$$d; \
if test ! -d $$a; then continue; else true; fi; \ if test ! -d $$a; then continue; else true; fi; \
@ -1479,7 +1507,12 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
echo $(INSTALL_DATA) $$i $(LIBDEST); \ echo $(INSTALL_DATA) $$i $(LIBDEST); \
fi; \ fi; \
done done
@for d in $(LIBSUBDIRS); \ @if test "$(TEST_MODULES)" = yes; then \
subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
else \
subdirs="$(LIBSUBDIRS)"; \
fi; \
for d in $$subdirs; \
do \ do \
a=$(srcdir)/Lib/$$d; \ a=$(srcdir)/Lib/$$d; \
if test ! -d $$a; then continue; else true; fi; \ if test ! -d $$a; then continue; else true; fi; \

View File

@ -0,0 +1,3 @@
Added ``--disable-test-modules`` option to the ``configure`` script:
don't build nor install test modules.
Patch by Xavier de Gaye, Thomas Petazzoni and Peixing Xin.

24
configure vendored
View File

@ -623,6 +623,7 @@ ac_includes_default="\
#endif" #endif"
ac_subst_vars='LTLIBOBJS ac_subst_vars='LTLIBOBJS
TEST_MODULES
OPENSSL_LDFLAGS OPENSSL_LDFLAGS
OPENSSL_LIBS OPENSSL_LIBS
OPENSSL_INCLUDES OPENSSL_INCLUDES
@ -852,6 +853,7 @@ with_openssl
with_ssl_default_suites with_ssl_default_suites
with_builtin_hashlib_hashes with_builtin_hashlib_hashes
with_experimental_isolated_subinterpreters with_experimental_isolated_subinterpreters
enable_test_modules
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@ -1503,6 +1505,7 @@ Optional Features:
--enable-big-digits[=15|30] --enable-big-digits[=15|30]
use big digits (30 or 15 bits) for Python longs use big digits (30 or 15 bits) for Python longs
(default is system-dependent)] (default is system-dependent)]
--disable-test-modules don't build nor install test modules
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -17725,6 +17728,26 @@ $as_echo "no" >&6; }
fi fi
# Check whether to disable test modules. Once set, setup.py will not build
# test extension modules and "make install" will not install test suites.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-test-modules" >&5
$as_echo_n "checking for --disable-test-modules... " >&6; }
# Check whether --enable-test-modules was given.
if test "${enable_test_modules+set}" = set; then :
enableval=$enable_test_modules;
fi
if test "$enable_test_modules" = no; then
TEST_MODULES=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
TEST_MODULES=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# generate output files # generate output files
ac_config_files="$ac_config_files Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh" ac_config_files="$ac_config_files Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh"
@ -19051,4 +19074,3 @@ if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
echo "" >&6 echo "" >&6
echo "" >&6 echo "" >&6
fi fi

View File

@ -5834,6 +5834,20 @@ else
fi], fi],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
# Check whether to disable test modules. Once set, setup.py will not build
# test extension modules and "make install" will not install test suites.
AC_MSG_CHECKING(for --disable-test-modules)
AC_ARG_ENABLE(test-modules,
AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules]))
if test "$enable_test_modules" = no; then
TEST_MODULES=no
AC_MSG_RESULT(yes)
else
TEST_MODULES=yes
AC_MSG_RESULT(no)
fi
AC_SUBST(TEST_MODULES)
# generate output files # generate output files
AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
@ -5860,4 +5874,3 @@ if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
echo "" >&AS_MESSAGE_FD echo "" >&AS_MESSAGE_FD
echo "" >&AS_MESSAGE_FD echo "" >&AS_MESSAGE_FD
fi fi

View File

@ -41,7 +41,7 @@ from distutils.spawn import find_executable
# Compile extensions used to test Python? # Compile extensions used to test Python?
TEST_EXTENSIONS = True TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
# This global variable is used to hold the list of modules to be disabled. # This global variable is used to hold the list of modules to be disabled.
DISABLED_MODULE_LIST = [] DISABLED_MODULE_LIST = []