Skip to content

Commit e4bb22f

Browse files
authored
bpo-45573: Add Modules/Setup.stdlib with conditional modules (GH-29615)
1 parent 21fa7a3 commit e4bb22f

File tree

6 files changed

+73
-2
lines changed

6 files changed

+73
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Misc/python-embed.pc
7676
Misc/python-config.sh
7777
Modules/Setup.config
7878
Modules/Setup.local
79+
Modules/Setup.stdlib
7980
Modules/config.c
8081
Modules/ld_so_aix
8182
Programs/_freeze_module

Makefile.pre.in

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,19 @@ oldsharedmods: $(SHAREDMODS) pybuilddir.txt
898898
fi; \
899899
done
900900

901+
Modules/Setup.local:
902+
@# Create empty Setup.local when file was deleted by user
903+
echo "# Edit this file for local setup changes" > $@
904+
905+
Modules/Setup.stdlib: $(srcdir)/Modules/Setup.stdlib.in config.status
906+
./config.status $@
907+
901908
Makefile Modules/config.c: Makefile.pre \
902909
$(srcdir)/Modules/config.c.in \
903910
$(MAKESETUP) \
904911
$(srcdir)/Modules/Setup \
905-
Modules/Setup.local
912+
Modules/Setup.local \
913+
Modules/Setup.stdlib
906914
$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
907915
-s Modules \
908916
Modules/Setup.local \
@@ -2159,6 +2167,7 @@ libainstall: @DEF_MAKE_RULE@ python-config
21592167
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
21602168
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
21612169
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
2170+
$(INSTALL_DATA) Modules/Setup.stdlib $(DESTDIR)$(LIBPL)/Setup.stdlib
21622171
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
21632172
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
21642173
$(INSTALL_DATA) Misc/python-embed.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc
@@ -2387,7 +2396,7 @@ distclean: clobber
23872396
if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \
23882397
done
23892398
-rm -f core Makefile Makefile.pre config.status Modules/Setup.local \
2390-
Modules/ld_so_aix Modules/python.exp Misc/python.pc \
2399+
Modules/Setup.stdlib Modules/ld_so_aix Modules/python.exp Misc/python.pc \
23912400
Misc/python-embed.pc Misc/python-config.sh
23922401
-rm -f python*-gdb.py
23932402
-rm -f Python/frozen_modules/*.h
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
``configure`` now creates ``Modules/Setup.stdlib`` with conditionally
2+
enabled/disabled extension module lines. The file is not used, yet.

Modules/Setup.stdlib.in

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -*- makefile -*-
2+
#
3+
# This file is autogenerated from Modules/Setup.stdlib.in.
4+
#
5+
6+
# The file is not used by default yet. For testing do:
7+
#
8+
# ln -sfr Modules/Setup.stdlib Modules/Setup.local
9+
#
10+
11+
# * @MODULE_{NAME}_TRUE@ is removed when configure detects all build
12+
# dependencies for a module. Otherwise the template variable is replaced
13+
# by a comment "#" and the module is skipped.
14+
# * Module lines without any compiler and linker flags automatically use
15+
# $(MODULE_{NAME}_CFLAGS) and $(MODULE_{NAME}_LDFLAGS). These flags are
16+
# generated by PY_STDLIB_MOD macro.
17+
# * All source files automatically depend on $(PYTHON_HEADERS) and
18+
# $(MODULE_{NAME}_DEPS).
19+
#
20+
# See Modules/Setup and Modules/makesetup
21+
#
22+
23+
24+
# Build modules statically or as shared extensions
25+
*shared*
26+
# *static*
27+
28+
29+
############################################################################
30+
# Modules that should always be present (POSIX and Windows):
31+
32+
# _decimal uses libmpdec
33+
# either static libmpdec.a from Modules/_decimal/libmpdec or libmpdec.so
34+
# with ./configure --with-system-libmpdec
35+
@MODULE__DECIMAL_TRUE@_decimal _decimal/_decimal.c
36+
37+
38+
############################################################################
39+
# XML and text
40+
41+
# pyexpat module uses libexpat
42+
# either static libexpat.a from Modules/expat or libexpat.so with
43+
# ./configure --with-system-expat
44+
@MODULE_PYEXPAT_TRUE@pyexpat pyexpat.c
45+
46+
# _elementtree libexpat via CAPI hook in pyexpat.
47+
@MODULE__ELEMENTTREE_TRUE@_elementtree _elementtree.c
48+
49+
50+
############################################################################
51+
# Modules with some UNIX dependencies
52+
#
53+
54+
# Linux and FreeBSD, needs sys/soundcard.h or linux/soundcard.h
55+
@MODULE_OSSAUDIODEV_TRUE@ossaudiodev ossaudiodev.c

configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19437,6 +19437,8 @@ $as_echo "$py_cv_module__decimal" >&6; }
1943719437
# generate output files
1943819438
ac_config_files="$ac_config_files Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh"
1943919439

19440+
ac_config_files="$ac_config_files Modules/Setup.stdlib"
19441+
1944019442
ac_config_files="$ac_config_files Modules/ld_so_aix"
1944119443

1944219444
cat >confcache <<\_ACEOF
@@ -20172,6 +20174,7 @@ do
2017220174
"Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
2017320175
"Misc/python-embed.pc") CONFIG_FILES="$CONFIG_FILES Misc/python-embed.pc" ;;
2017420176
"Misc/python-config.sh") CONFIG_FILES="$CONFIG_FILES Misc/python-config.sh" ;;
20177+
"Modules/Setup.stdlib") CONFIG_FILES="$CONFIG_FILES Modules/Setup.stdlib" ;;
2017520178
"Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;;
2017620179

2017720180
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6005,6 +6005,7 @@ AC_SUBST([MODULE_BLOCK])
60056005

60066006
# generate output files
60076007
AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
6008+
AC_CONFIG_FILES([Modules/Setup.stdlib])
60086009
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
60096010
AC_OUTPUT
60106011

0 commit comments

Comments
 (0)