Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-45573: Move mandatory core modules to Modules/Setup.core
Signed-off-by: Christian Heimes <christian@python.org>
  • Loading branch information
tiran committed Nov 19, 2021
commit a613d444f95bbb1b504de3e2a6ba569da6b98109
3 changes: 3 additions & 0 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -910,10 +910,12 @@ Makefile Modules/config.c: Makefile.pre \
$(MAKESETUP) \
$(srcdir)/Modules/Setup \
Modules/Setup.local \
$(srcdir)/Modules/Setup.core \
Modules/Setup.stdlib
$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
-s Modules \
Modules/Setup.local \
$(srcdir)/Modules/Setup.core \
$(srcdir)/Modules/Setup
@mv config.c Modules
@echo "The Makefile was updated, you may need to re-run make."
Expand Down Expand Up @@ -2167,6 +2169,7 @@ libainstall: @DEF_MAKE_RULE@ python-config
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
$(INSTALL_DATA) $(srcdir)/Modules/Setup.core $(DESTDIR)$(LIBPL)/Setup.core
$(INSTALL_DATA) Modules/Setup.stdlib $(DESTDIR)$(LIBPL)/Setup.stdlib
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mandatory core modules are now in ``Modules/Setup.core``
27 changes: 2 additions & 25 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,8 @@ PYTHONPATH=$(COREPYTHONPATH)


# ---
# Built-in modules required to get a functioning interpreter;
# cannot be built as shared!

_collections _collectionsmodule.c
_abc _abc.c
_codecs _codecsmodule.c
_functools _functoolsmodule.c
_io -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
_locale _localemodule.c
_operator _operator.c
_signal signalmodule.c
_sre _sre.c
_stat _stat.c
_symtable symtablemodule.c
_thread _threadmodule.c
_tracemalloc _tracemalloc.c # See bpo-35053 as to why this is built in.
_weakref _weakref.c
atexit atexitmodule.c
errno errnomodule.c
faulthandler faulthandler.c
itertools itertoolsmodule.c
posix posixmodule.c
pwd pwdmodule.c
time timemodule.c

# Built-in modules required to get a functioning interpreter are listed in
# Modules/Setup.core.

# ---
# The rest of the modules listed in this file are all commented out by
Expand Down
34 changes: 34 additions & 0 deletions Modules/Setup.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- makefile -*-

# ---
# Built-in modules required to get a functioning interpreter;
# cannot be built as shared!

# module C APIs are used in core
atexit atexitmodule.c
faulthandler faulthandler.c
posix posixmodule.c
_signal signalmodule.c
_tracemalloc _tracemalloc.c
Comment thread
tiran marked this conversation as resolved.
Outdated

# modules used by importlib, deepfreeze, freeze, runpy, and sysconfig
_codecs _codecsmodule.c
_collections _collectionsmodule.c
errno errnomodule.c
_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
itertools itertoolsmodule.c
_sre _sre.c
_thread _threadmodule.c
time timemodule.c
_weakref _weakref.c
Comment thread
tiran marked this conversation as resolved.
Outdated

# commonly used core modules
_abc _abc.c
_functools _functoolsmodule.c
_locale _localemodule.c
_operator _operator.c
_stat _stat.c
_symtable symtablemodule.c

# for systems without $HOME env, used by site._getuserbase()
pwd pwdmodule.c
45 changes: 44 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -19456,6 +19456,49 @@ MODULE_BLOCK=



# This is what autoupdate's m4 run will expand. It fires
# the warning (with _au_warn_XXX), outputs it into the
# updated configure.ac (with AC_DIAGNOSE), and then outputs
# the replacement expansion.


# This is an auxiliary macro that is also run when
# autoupdate runs m4. It simply calls m4_warning, but
# we need a wrapper so that each warning is emitted only
# once. We break the quoting in m4_warning's argument in
# order to expand this macro's arguments, not AU_DEFUN's.


# Finally, this is the expansion that is picked up by
# autoconf. It tells the user to run autoupdate, and
# then outputs the replacement expansion. We do not care
# about autoupdate's warning because that contains
# information on what to do *after* running autoupdate.




as_fn_append MODULE_BLOCK "MODULE_IO_CFLAGS=-I\$(srcdir)/Modules/_io$as_nl"


as_fn_append MODULE_BLOCK "MODULE_IO_LDFLAGS=$TIMEMODULE_LIB$as_nl"






as_fn_append MODULE_BLOCK "MODULE_TIME_LDFLAGS=$TIMEMODULE_LIB$as_nl"





as_fn_append MODULE_BLOCK "MODULE__DATETIME_LDFLAGS=$TIMEMODULE_LIB$as_nl"




{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module ossaudiodev" >&5
$as_echo_n "checking for stdlib extension module ossaudiodev... " >&6; }
case $py_stdlib_not_available in #(
Expand Down Expand Up @@ -21068,7 +21111,7 @@ fi
echo "creating Makefile" >&6
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
-s Modules \
Modules/Setup.local $srcdir/Modules/Setup
Modules/Setup.local $srcdir/Modules/Setup.core $srcdir/Modules/Setup
mv config.c Modules

if test -z "$PKG_CONFIG"; then
Expand Down
27 changes: 26 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6030,6 +6030,31 @@ AC_DEFUN([PY_STDLIB_MOD], [
m4_popdef([modstate])dnl
])

dnl Define simple, always enabled stdlib extension module
dnl PY_STDLIB_MOD_SIMPLE([NAME], [CFLAGS], [LDFLAGS])
dnl cflags and ldflags are optional
AC_DEFUN([PY_STDLIB_MOD_SIMPLE], [
m4_pushdef([modcond], [MODULE_]m4_toupper([$1]))dnl
dnl _MODULE_BLOCK_ADD(modcond, [yes])
dnl AM_CONDITIONAL(modcond, [true])
Comment thread
tiran marked this conversation as resolved.
Outdated
m4_ifval([$2], [
_MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_CFLAGS], [$2])
])
m4_ifval([$3], [
_MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_LDFLAGS], [$3])
])
m4_popdef([modcond])dnl
])
dnl alias for static core modules (Modules/Setup.core)
AU_ALIAS([PY_STDLIB_MOD_CORE], [PY_STDLIB_MOD_SIMPLE])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the alias?


dnl static modules in Modules/Setup.core
PY_STDLIB_MOD_SIMPLE([io], [-I\$(srcdir)/Modules/_io], [$TIMEMODULE_LIB])

dnl always enabled extension modules
PY_STDLIB_MOD_SIMPLE([time], [], [$TIMEMODULE_LIB])
PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB])

dnl platform specific extensions
PY_STDLIB_MOD([ossaudiodev],
[], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes])
Expand Down Expand Up @@ -6062,7 +6087,7 @@ fi
echo "creating Makefile" >&AS_MESSAGE_FD
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
-s Modules \
Modules/Setup.local $srcdir/Modules/Setup
Modules/Setup.local $srcdir/Modules/Setup.core $srcdir/Modules/Setup
mv config.c Modules

if test -z "$PKG_CONFIG"; then
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,9 @@ def detect_simple_extensions(self):
if lib:
time_libs.append(lib)

# time operations and variables
self.add(Extension('time', ['timemodule.c'],
libraries=time_libs))
# time operations and variables, always built by Modules/Setup.core
# self.add(Extension('time', ['timemodule.c'],
# libraries=time_libs))
Comment thread
tiran marked this conversation as resolved.
Outdated
# libm is needed by delta_new() that uses round() and by accum() that
# uses modf().
self.add(Extension('_datetime', ['_datetimemodule.c'],
Expand All @@ -1034,8 +1034,8 @@ def detect_simple_extensions(self):
self.add(Extension('_opcode', ['_opcode.c']))
# asyncio speedups
self.add(Extension("_asyncio", ["_asynciomodule.c"]))
# _abc speedups
self.add(Extension("_abc", ["_abc.c"]))
# _abc speedups, always built by Modules/Setup.core
# self.add(Extension("_abc", ["_abc.c"]))
Comment thread
tiran marked this conversation as resolved.
Outdated
# _queue module
self.add(Extension("_queue", ["_queuemodule.c"]))
# _statistics module
Expand All @@ -1054,8 +1054,8 @@ def detect_simple_extensions(self):
libs = ['bsd']
self.add(Extension('fcntl', ['fcntlmodule.c'],
libraries=libs))
# pwd(3)
self.add(Extension('pwd', ['pwdmodule.c']))
# pwd(3), always built by Modules/Setup.core
# self.add(Extension('pwd', ['pwdmodule.c']))
Comment thread
tiran marked this conversation as resolved.
Outdated
# grp(3)
if not VXWORKS:
self.add(Extension('grp', ['grpmodule.c']))
Expand Down