diff --git a/Misc/NEWS.d/next/Build/2026-10-15-11-20-48.gh-issue-159440.uIz6ms.rst b/Misc/NEWS.d/next/Build/2026-10-15-11-20-48.gh-issue-159440.uIz6ms.rst new file mode 100644 index 000000000000000..6c6cc43fd2e60d0 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-10-15-11-20-48.gh-issue-159440.uIz6ms.rst @@ -0,0 +1,3 @@ +The version string reported by ``sys.version`` no longer carries a spurious +``-dirty`` suffix when CPython is built out-of-tree from a clean git checkout: +the build stamp now checks the source tree instead of the build directory. diff --git a/configure b/configure index a628d337003b1ef..217d8e135600e16 100755 --- a/configure +++ b/configure @@ -3694,9 +3694,9 @@ HAS_GIT=no-repository fi if test $HAS_GIT = found then - GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD" - GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty" - GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD" + GITVERSION="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) rev-parse --short HEAD" + GITTAG="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) describe --all --always --dirty" + GITBRANCH="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) name-rev --name-only HEAD" else GITVERSION="" GITTAG="" diff --git a/configure.ac b/configure.ac index cf01e6fa82bceb6..ca804d6448810d2 100644 --- a/configure.ac +++ b/configure.ac @@ -128,9 +128,9 @@ HAS_GIT=no-repository fi if test $HAS_GIT = found then - GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD" - GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty" - GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD" + GITVERSION="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) rev-parse --short HEAD" + GITTAG="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) describe --all --always --dirty" + GITBRANCH="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) name-rev --name-only HEAD" else GITVERSION="" GITTAG=""