8000 bpo-27640: Add --disable-test-modules configure option (GH-23886) · python/cpython@277ce30 · GitHub
[go: up one dir, main page]

Skip to content

Commit 277ce30

Browse files
pxinwrtpetazzonixdegaye
authored
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>
1 parent c56387f commit 277ce30

File tree

6 files changed

+116
-41
lines changed

6 files changed

+116
-41
lines changed

Doc/whatsnew/3.10.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,10 @@ Build Changes
558558
* The :mod:`atexit` module must now always be built as a built-in module.
559559
(Contributed by Victor Stinner in :issue:`42639`.)
560560

561+
* Added ``--disable-test-modules`` option to the ``configure`` script:
562+
don't build nor install test modules.
563+
(Contributed by Xavier de Gaye, Thomas Petazzoni and Peixing Xin in :issue:`27640`.)
564+
561565

562566
C API Changes
563567
=============

Makefile.pre.in

Lines changed: 71 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,27 +1366,61 @@ maninstall: altmaninstall
13661366

13671367
# Install the library
13681368
XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
1369-
LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
1370-
tkinter/test/test_ttk site-packages test \
1371-
test/audiodata \
1372-
test/capath test/data \
1373-
test/cjkencodings test/decimaltestdata \
1374-
test/xmltestdata test/xmltestdata/c14n-20 \
1375-
test/dtracedata \
1376-
test/eintrdata \
1377-
test/imghdrdata \
1378-
test/libregrtest \
1379-
test/subprocessdata test/sndhdrdata test/support \
1380-
test/tracedmodules test/encoded_modules \
1369+
LIBSUBDIRS= asyncio \
1370+
collections \
1371+
concurrent concurrent/futures \
1372+
csv \
1373+
ctypes ctypes/macholib \
1374+
curses \
1375+
dbm \
1376+
distutils distutils/command \
1377+
email email/mime \
1378+
encodings \
1379+
ensurepip ensurepip/_bundled \
1380+
html \
1381+
http \
1382+
idlelib idlelib/Icons \
1383+
importlib importlib/metadata \
1384+
json \
1385+
lib2to3 lib2to3/fixes lib2to3/pgen2 \
1386+
logging \
1387+
multiprocessing multiprocessing/dummy \
1388+
pydoc_data \
1389+
site-packages \
1390+
sqlite3 \
1391+
tkinter \
1392+
turtledemo \
1393+
unittest \
1394+
urllib \
1395+
venv venv/scripts venv/scripts/common venv/scripts/posix \
1396+
wsgiref \
1397+
$(XMLLIBSUBDIRS) \
1398+
xmlrpc \
1399+
zoneinfo
1400+
TESTSUBDIRS= ctypes/test \
1401+
distutils/tests \
1402+
idlelib/idle_test \
1403+
lib2to3/tests \
1404+
lib2to3/tests/data \
1405+
lib2to3/tests/data/fixers \
1406+
lib2to3/tests/data/fixers/myfixes \
1407+
sqlite3/test \
1408+
test test/audiodata \
1409+
test/capath test/cjkencodings \
1410+
test/data test/decimaltestdata \
1411+
test/dtracedata test/eintrdata \
1412+
test/encoded_modules test/imghdrdata \
1413+
test/libregrtest test/sndhdrdata \
1414+
test/subprocessdata test/support \
1415+
test/test_asyncio \
1416+
test/test_email test/test_email/data \
13811417
test/test_import \
13821418
test/test_import/data \
13831419
test/test_import/data/circular_imports \
13841420
test/test_import/data/circular_imports/subpkg \
13851421
test/test_import/data/package \
13861422
test/test_import/data/package2 \
13871423
test/test_import/data/unwritable \
1388-
importlib \
1389-
importlib/metadata \
13901424
test/test_importlib \
13911425
test/test_importlib/builtin \
13921426
test/test_importlib/data \
@@ -1425,30 +1459,19 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
14251459
test/test_importlib/source \
14261460
test/test_importlib/zipdata01 \
14271461
test/test_importlib/zipdata02 \
1462+
test/test_json \
1463+
test/test_peg_generator \
1464+
test/test_tools \
1465+
test/test_warnings test/test_warnings/data \
14281466
test/test_zoneinfo test/test_zoneinfo/data \
1467+
test/tracedmodules \
1468+
test/xmltestdata test/xmltestdata/c14n-20 \
14291469
test/ziptestdata \
1430-
asyncio \
1431-
test/test_asyncio \
1432-
collections concurrent concurrent/futures encodings \
1433-
email email/mime test/test_email test/test_email/data \
1434-
ensurepip ensurepip/_bundled \
1435-
html json test/test_json http dbm xmlrpc \
1436-
sqlite3 sqlite3/test \
1437-
logging csv wsgiref urllib \
1438-
lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
1439-
lib2to3/tests/data lib2to3/tests/data/fixers \
1440-
lib2to3/tests/data/fixers/myfixes \
1441-
ctypes ctypes/test ctypes/macholib \
1442-
idlelib idlelib/Icons idlelib/idle_test \
1443-
distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
1444-
test/test_peg_generator \
1445-
test/test_tools test/test_warnings test/test_warnings/data \
1446-
turtledemo \
1447-
multiprocessing multiprocessing/dummy \
1448-
unittest unittest/test unittest/test/testmock \
1449-
venv venv/scripts venv/scripts/common venv/scripts/posix \
1450-
curses pydoc_data \
1451-
zoneinfo
1470+
tkinter/test tkinter/test/test_tkinter \
1471+
tkinter/test/test_ttk \
1472+
unittest/test unittest/test/testmock
1473+
1474+
TEST_MODULES=@TEST_MODULES@
14521475
libinstall: build_all $(srcdir)/Modules/xxmodule.c
14531476
@for i in $(SCRIPTDIR) $(LIBDEST); \
14541477
do \
@@ -1458,7 +1481,12 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
14581481
else true; \
14591482
fi; \
14601483
done
1461-
@for d in $(LIBSUBDIRS); \
1484+
@if test "$(TEST_MODULES)" = yes; then \
1485+
subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
1486+
else \
1487+
subdirs="$(LIBSUBDIRS)"; \
1488+
fi; \
1489+
for d in $$subdirs; \
14621490
do \
14631491
a=$(srcdir)/Lib/$$d; \
14641492
if test ! -d $$a; then continue; else true; fi; \
@@ -1479,7 +1507,12 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c
14791507
echo $(INSTALL_DATA) $$i $(LIBDEST); \
14801508
fi; \
14811509
done
1482-
@for d in $(LIBSUBDIRS); \
1510+
@if test "$(TEST_MODULES)" = yes; then \
1511+
subdirs="$(LIBSUBDIRS) $(TESTSUBDIRS)"; \
1512+
else \
1513+
subdirs="$(LIBSUBDIRS)"; \
1514+
fi; \
1515+
for d in $$subdirs; \
14831516
do \
14841517
a=$(srcdir)/Lib/$$d; \
14851518
if test ! -d $$a; then continue; else true; fi; \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Added ``--disable-test-modules`` option to the ``configure`` script:
2+
don't build nor install test modules.
3+
Patch by Xavier de Gaye, Thomas Petazzoni and Peixing Xin.

configure

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ ac_includes_default="\
623623
#endif"
624624

625625
ac_subst_vars='LTLIBOBJS
626+
TEST_MODULES
626627
OPENSSL_LDFLAGS
627628
OPENSSL_LIBS
628629
OPENSSL_INCLUDES
@@ -852,6 +853,7 @@ with_openssl
852853
with_ssl_default_suites
853854
with_builtin_hashlib_hashes
854855
with_experimental_isolated_subinterpreters
856+
enable_test_modules
855857
'
856858
ac_precious_vars='build_alias
857859
host_alias
@@ -1503,6 +1505,7 @@ Optional Features:
15031505
--enable-big-digits[=15|30]
15041506
use big digits (30 or 15 bits) for Python longs
15051507
(default is system-dependent)]
1508+
--disable-test-modules don't build nor install test modules
15061509

15071510
Optional Packages:
15081511
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -17725,6 +17728,26 @@ $as_echo "no" >&6; }
1772517728
fi
1772617729

1772717730

17731+
# Check whether to disable test modules. Once set, setup.py will not build
17732+
# test extension modules and "make install" will not install test suites.
17733+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-test-modules" >&5
17734+
$as_echo_n "checking for --disable-test-modules... " >&6; }
17735+
# Check whether --enable-test-modules was given.
17736+
if test "${enable_test_modules+set}" = set; then :
17737+
enableval=$enable_test_modules;
17738+
fi
17739+
17740+
if test "$enable_test_modules" = no; then
17741+
TEST_MODULES=no
17742+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
17743+
$as_echo "yes" >&6; }
17744+
else
17745+
TEST_MODULES=yes
17746+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
17747+
$as_echo "no" >&6; }
17748+
fi
17749+
17750+
1772817751

1772917752
# generate output files
1773017753
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
1905119074
echo "" >&6
1905219075
echo "" >&6
1905319076
fi
19054-

configure.ac

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5834,6 +5834,20 @@ else
58345834
fi],
58355835
[AC_MSG_RESULT(no)])
58365836

5837+
# Check whether to disable test modules. Once set, setup.py will not build
5838+
# test extension modules and "make install" will not install test suites.
5839+
AC_MSG_CHECKING(for --disable-test-modules)
5840+
AC_ARG_ENABLE(test-modules,
5841+
AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules]))
5842+
if test "$enable_test_modules" = no; then
5843+
TEST_MODULES=no
5844+
AC_MSG_RESULT(yes)
5845+
else
5846+
TEST_MODULES=yes
5847+
AC_MSG_RESULT(no)
5848+
fi
5849+
AC_SUBST(TEST_MODULES)
5850+
58375851

58385852
# generate output files
58395853
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
58605874
echo "" >&AS_MESSAGE_FD
58615875
echo "" >&AS_MESSAGE_FD
58625876
fi
5863-

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242

4343
# Compile extensions used to test Python?
44-
TEST_EXTENSIONS = True
44+
TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
4545

4646
# This global variable is used to hold the list of modules to be disabled.
4747
DISABLED_MODULE_LIST = []

0 commit comments

Comments
 (0)
0