2001-12-04 02:11:32 +01:00
|
|
|
#include "Python.h"
|
1997-05-21 00:40:26 +02:00
|
|
|
|
1999-08-27 22:39:37 +02:00
|
|
|
#ifndef DONT_HAVE_STDIO_H
|
1997-01-20 19:34:26 +01:00
|
|
|
#include <stdio.h>
|
1999-08-27 22:39:37 +02:00
|
|
|
#endif
|
1997-01-20 19:34:26 +01: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 20:51:24 +01:00
|
|
|
/* XXX Only unix build process has been tested */
|
|
|
|
#ifndef HGVERSION
|
|
|
|
#define HGVERSION ""
|
|
|
|
#endif
|
|
|
|
#ifndef HGTAG
|
|
|
|
#define HGTAG ""
|
|
|
|
#endif
|
|
|
|
#ifndef HGBRANCH
|
|
|
|
#define HGBRANCH ""
|
|
|
|
#endif
|
|
|
|
|
2005-12-18 02:27:35 +01:00
|
|
|
const char *
|
2005-12-18 23:46:35 +01:00
|
|
|
Py_GetBuildInfo(void)
|
2005-12-18 02:27:35 +01:00
|
|
|
{
|
2011-03-29 00:25:15 +02:00
|
|
|
static char buildinfo[50 + sizeof(HGVERSION) +
|
|
|
|
((sizeof(HGTAG) > sizeof(HGBRANCH)) ?
|
|
|
|
sizeof(HGTAG) : sizeof(HGBRANCH))];
|
2011-03-05 20:51:24 +01:00
|
|
|
const char *revision = _Py_hgversion();
|
2010-05-09 18:14:21 +02:00
|
|
|
const char *sep = *revision ? ":" : "";
|
2011-03-05 20:51:24 +01:00
|
|
|
const char *hgid = _Py_hgidentifier();
|
|
|
|
if (!(*hgid))
|
|
|
|
hgid = "default";
|
2010-05-09 18:14:21 +02:00
|
|
|
PyOS_snprintf(buildinfo, sizeof(buildinfo),
|
2011-03-05 20:51:24 +01:00
|
|
|
"%s%s%s, %.20s, %.9s", hgid, sep, revision,
|
2010-05-09 18:14:21 +02:00
|
|
|
DATE, TIME);
|
|
|
|
return buildinfo;
|
2005-12-18 02:27:35 +01:00
|
|
|
}
|
2005-12-19 15:43:44 +01:00
|
|
|
|
2011-03-05 20:51:24 +01:00
|
|
|
const char *
|
|
|
|
_Py_hgversion(void)
|
|
|
|
{
|
|
|
|
return HGVERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
_Py_hgidentifier(void)
|
|
|
|
{
|
|
|
|
const char *hgtag, *hgid;
|
|
|
|
hgtag = HGTAG;
|
|
|
|
if ((*hgtag) && strcmp(hgtag, "tip") != 0)
|
|
|
|
hgid = hgtag;
|
|
|
|
else
|
|
|
|
hgid = HGBRANCH;
|
|
|
|
return hgid;
|
|
|
|
}
|