Skip to content

generate-build-details.py --relative-paths --config-file-path writes wrong paths #160004

Open

Description

@itamaro

Bug report

PEP 739 says a relative base_prefix is relative to the directory that contains build-details.json, and the other paths are relative to base_prefix. With --relative-paths --config-file-path, make_paths_relative() first replaces base_prefix with a path relative to the config file's directory, such as ../... It then computes the other paths relative to that relative base_prefix instead of the absolute one, so they're wrong.

For example, for an install whose prefix is /opt/python, running this from /tmp/build:

./python Tools/build/generate-build-details.py \
    /opt/python/lib/python3.16/build-details.json \
    --relative-paths \
    --config-file-path /opt/python/lib/python3.16/build-details.json

writes "base_prefix": "../..", which is correct, but also "headers": "./opt/python/include/python3.16" instead of ./include/python3.16. base_interpreter and the libpython paths are wrong in the same way. Because the relative base_prefix ends up resolved against the current directory, the wrong values also change with the directory the script runs from: from /Users/me/src/cpython/build, headers becomes ./../../../opt/python/include/python3.16.

see astral-sh/python-build-standalone#885 for example of how PBS deals with this issue.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Activity

  1. added
    buildThe build process and cross-build
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions