Skip to content

Add configure.py, a configure.ac replacement#146034

Draft
nascheme wants to merge 40 commits intopython:mainfrom
nascheme:configure_py
Draft

Add configure.py, a configure.ac replacement#146034
nascheme wants to merge 40 commits intopython:mainfrom
nascheme:configure_py

Conversation

@nascheme
Copy link
Copy Markdown
Member

CPython's build configuration is driven by configure.ac (8,344 lines, ~271
KB), which uses autoconf/M4 macros to generate a 946 KB shell script
(configure). This system is:

  • Opaque and hard to read/maintain (M4 macro language)
  • Inefficient (generates a giant shell script, then runs it)
  • Difficult to extend or debug

This replaces it with a Python-based build configuration system where
Tools/configure/configure.py is a real Python script that imports a pyconf
module. The pyconf functions generally match the autoconf behaviour, so that
translation from the configure.ac file is mostly direct and mechanical.

There is also a transpiler that converts configure.py into POSIX AWK (wrapped
in a small shell stub). The transpiler lives in Tools/configure/transpiler/
and the pipeline is: Python AST → pysh_ast → awk_ast → AWK text. The sh and
AWK code needs to be compatible with those tools on various Unix-like operating
systems.

nascheme added 27 commits March 16, 2026 11:37
Assisted-by: claude-opus-4-6
Keep srcdir as an absolute path if it was originally.  Match host_prefix
setting done by configure.ac.  Fix AWK implementations of
pyconf_env_var(), pyconf_check_header() and pyconf_check_decl().
Match the autoconf macro behavior: set per-package variables
(ZLIB_CFLAGS, ZLIB_LIBS, etc.) only when the system is Emscripten and
the user hasn't already provided values.
@nascheme nascheme changed the title Add configure.py, an configure.ac replacement Add configure.py, a configure.ac replacement Mar 27, 2026
@nascheme nascheme added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 28, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @nascheme for commit 6088c5e 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146034%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 28, 2026
@nascheme nascheme added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 28, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @nascheme for commit c643245 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146034%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 28, 2026
@nascheme nascheme added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 28, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @nascheme for commit ea140e1 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146034%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Mar 28, 2026
Pass srcdir to the AWK script.  Look in srcdir when generating
config files.
It seems some awk implementations have memory corruption bug, avoid
creating large strings with concat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants