2001-12-03 21:11:32 -04:00
|
|
|
#include "Python.h"
|
1997-05-20 19:40:26 -03:00
|
|
|
|
1999-08-27 17:39:37 -03:00
|
|
|
#ifndef DONT_HAVE_STDIO_H
|
1997-01-20 14:34:26 -04:00
|
|
|
#include <stdio.h>
|
1999-08-27 17:39:37 -03:00
|
|
|
#endif
|
1997-01-20 14:34:26 -04:00
|
|
|
|
|
|
|
#ifndef DATE
|
|
|
|
#ifdef __DATE__
|
|
|
|
#define DATE __DATE__
|
|
|
|
#else
|
|
|
|
#define DATE "xx/xx/xx"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TIME
|
|
|
|
#ifdef __TIME__
|
|
|
|
#define TIME __TIME__
|
|
|
|
#else
|
|
|
|
#define TIME "xx:xx:xx"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2011-03-05 15:51:24 -04:00
|
|
|
/* XXX Only unix build process has been tested */
|
2017-03-04 01:19:55 -04:00
|
|
|
#ifndef GITVERSION
|
|
|
|
#define GITVERSION ""
|
2011-03-05 15:51:24 -04:00
|
|
|
#endif
|
2017-03-04 01:19:55 -04:00
|
|
|
#ifndef GITTAG
|
|
|
|
#define GITTAG ""
|
2011-03-05 15:51:24 -04:00
|
|
|
#endif
|
2017-03-04 01:19:55 -04:00
|
|
|
#ifndef GITBRANCH
|
|
|
|
#define GITBRANCH ""
|
2011-03-05 15:51:24 -04:00
|
|
|
#endif
|
|
|
|
|
2005-12-17 21:27:35 -04:00
|
|
|
const char *
|
2005-12-18 18:46:35 -04:00
|
|
|
Py_GetBuildInfo(void)
|
2005-12-17 21:27:35 -04:00
|
|
|
{
|
2017-03-04 01:19:55 -04:00
|
|
|
static char buildinfo[50 + sizeof(GITVERSION) +
|
|
|
|
((sizeof(GITTAG) > sizeof(GITBRANCH)) ?
|
|
|
|
sizeof(GITTAG) : sizeof(GITBRANCH))];
|
|
|
|
const char *revision = _Py_gitversion();
|
2010-05-09 13:14:21 -03:00
|
|
|
const char *sep = *revision ? ":" : "";
|
2017-03-04 01:19:55 -04:00
|
|
|
const char *gitid = _Py_gitidentifier();
|
2021-10-20 14:09:03 -03:00
|
|
|
if (!(*gitid)) {
|
|
|
|
gitid = "main";
|
|
|
|
}
|
2010-05-09 13:14:21 -03:00
|
|
|
PyOS_snprintf(buildinfo, sizeof(buildinfo),
|
2017-03-04 01:19:55 -04:00
|
|
|
"%s%s%s, %.20s, %.9s", gitid, sep, revision,
|
2010-05-09 13:14:21 -03:00
|
|
|
DATE, TIME);
|
|
|
|
return buildinfo;
|
2005-12-17 21:27:35 -04:00
|
|
|
}
|
2005-12-19 10:43:44 -04:00
|
|
|
|
2011-03-05 15:51:24 -04:00
|
|
|
const char *
|
2017-03-04 01:19:55 -04:00
|
|
|
_Py_gitversion(void)
|
2011-03-05 15:51:24 -04:00
|
|
|
{
|
2017-03-04 01:19:55 -04:00
|
|
|
return GITVERSION;
|
2011-03-05 15:51:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
2017-03-04 01:19:55 -04:00
|
|
|
_Py_gitidentifier(void)
|
2011-03-05 15:51:24 -04:00
|
|
|
{
|
2017-03-04 01:19:55 -04:00
|
|
|
const char *gittag, *gitid;
|
|
|
|
gittag = GITTAG;
|
|
|
|
if ((*gittag) && strcmp(gittag, "undefined") != 0)
|
|
|
|
gitid = gittag;
|
2011-03-05 15:51:24 -04:00
|
|
|
else
|
2017-03-04 01:19:55 -04:00
|
|
|
gitid = GITBRANCH;
|
|
|
|
return gitid;
|
2011-03-05 15:51:24 -04:00
|
|
|
}
|