build-python3.sh: remove test modules to reduce size - #171
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces the size of the Python 3 installation produced by build-python3.sh, aiming to minimize bootstrap footprint while still providing a usable Python needed for building glibc and related packages.
Changes:
- Overrides Python鈥檚 build
OPTflags to avoid carrying debug symbols into the installation. - Configures CPython to avoid installing test modules,
ensurepip, and the staticlibpythonarchive to reduce installed size.
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test modules are for self-testing Python so aren't needed by glibc. They account for ~120M of installation which is a third of the total size. Also avoid installing libpython.a (~43M) and setting up ensurepip (~23M) which shouldn't be needed to build glibc.
cho-m
force-pushed
the
build-python3-reduce-size
branch
from
August 3, 2026 15:23
b8ec4d5 to
481c00b
Compare
p-linnane
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test modules are for self-testing Python so aren't needed by glibc. They account for ~120M of installation which is a third of the total size.
The default OPT sets-gwhich adds another 20M of unused debug symbols. We can override this to avoid bloatAlso avoid installing libpython.a (~43M) and setting up ensurepip (~23M) which shouldn't be needed to build glibc.
glibc is one of packages that may need to be built from source so keeping sizes small indirectly helps with faster install.