Implement dynamic git version information in build metadata

- Added CMake git detection to capture branch and commit hash
- Modified frozen_stubs.c to use CMake-provided git information
- Build info now shows actual git metadata instead of "default"
- Updated STUBS.md to reflect improvement

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-28 23:41:56 +00:00
parent 9af9379805
commit f55db59a1a
3 changed files with 55 additions and 10 deletions

View File

@@ -34,22 +34,32 @@ struct _inittab _PyImport_Inittab[] = {
};
/* Build info stubs */
/* Use CMake-generated git information if available */
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "unknown"
#endif
#ifndef GIT_BRANCH
#define GIT_BRANCH "default"
#endif
const char *
Py_GetBuildInfo(void)
{
return "Typthon 3.14.0 (default, " __DATE__ " " __TIME__ ")";
return "Typthon 3.14.0 (" GIT_BRANCH ":" GIT_COMMIT_HASH ", " __DATE__ " " __TIME__ ")";
}
const char *
_Py_gitidentifier(void)
{
return "default";
return GIT_BRANCH;
}
const char *
_Py_gitversion(void)
{
return "Typthon 3.14.0";
return "Typthon 3.14.0:" GIT_COMMIT_HASH;
}
/* DL open flags stub */