Skip to content

Skip Python installation paths for build-tree Python - #10236

Open
jameshilliard wants to merge 2 commits into
python-pillow:mainfrom
jameshilliard:fix-disable-platform-guessing-sysconfig
Open

jameshilliard wants to merge 2 commits into
python-pillow:mainfrom
jameshilliard:fix-disable-platform-guessing-sysconfig

Conversation

@jameshilliard

Copy link
Copy Markdown
Contributor

When building against an uninstalled Python, LIBDIR and INCLUDEDIR can describe the eventual installation rather than usable build-time paths. The sysconfig-based lookups added in #7634 can therefore add unprefixed paths such as /usr/lib and /usr/include when cross-compiling.

Changes proposed in this pull request:

  • Guard the two additional Python installation-directory lookups with sysconfig.is_python_build(), leaving Python header and library configuration to setuptools.
  • Preserve the existing sysconfig lookups and sys.prefix fallbacks for installed Python.
  • Add a release note.

Testing

  • Built and installed a native CPython 3.14 wheel.
  • python3 selftest.py: 59 tests passed.
  • Focused tests covering sanity checks, features and image operations: 210 passed, 2 skipped.
  • Dependency detection, without compilation, checked with installed native Python, uninstalled native Python and an AArch64 cross-compilation environment. JPEG, zlib, TIFF, OpenJPEG, FreeType, LittleCMS and WebP were detected successfully in each environment.
  • Eight focused guard checks passed, covering build-tree detection, virtualenvs and missing configuration values.
  • Pre-commit checks and release-note validation passed.

@chewi chewi left a comment

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.

Successfully tested on Gentoo. Thank you. Sorry for the fallout.

@radarhere radarhere added the 🤖-assisted AI-assisted label Oct 19, 2026
@radarhere
radarhere requested a review from hugovk October 19, 2026 07:46

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-assisted AI-assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants