Staging
v0.5.1
https://github.com/python/cpython
Revision 7a240aef1526e56943381dca3fbda139962500f2 authored by Zackery Spytz on 28 November 2020, 21:46:30 UTC, committed by GitHub on 28 November 2020, 21:46:30 UTC
Commit 035deee265c7fb227ddc87222fa48761231d8bd7 converted the
_posixsubprocess module to multiphase initialization, but the news entry
mentions the _posixshmem module.
1 parent fa840cc
Raw File
Tip revision: 7a240aef1526e56943381dca3fbda139962500f2 authored by Zackery Spytz on 28 November 2020, 21:46:30 UTC
Fix an error in the news entry for _posixsubprocess multiphase init (GH-23516)
Tip revision: 7a240ae
getbuildinfo.c
#include "Python.h"

#ifndef DONT_HAVE_STDIO_H
#include <stdio.h>
#endif

#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

/* XXX Only unix build process has been tested */
#ifndef GITVERSION
#define GITVERSION ""
#endif
#ifndef GITTAG
#define GITTAG ""
#endif
#ifndef GITBRANCH
#define GITBRANCH ""
#endif

const char *
Py_GetBuildInfo(void)
{
    static char buildinfo[50 + sizeof(GITVERSION) +
                          ((sizeof(GITTAG) > sizeof(GITBRANCH)) ?
                           sizeof(GITTAG) : sizeof(GITBRANCH))];
    const char *revision = _Py_gitversion();
    const char *sep = *revision ? ":" : "";
    const char *gitid = _Py_gitidentifier();
    if (!(*gitid))
        gitid = "default";
    PyOS_snprintf(buildinfo, sizeof(buildinfo),
                  "%s%s%s, %.20s, %.9s", gitid, sep, revision,
                  DATE, TIME);
    return buildinfo;
}

const char *
_Py_gitversion(void)
{
    return GITVERSION;
}

const char *
_Py_gitidentifier(void)
{
    const char *gittag, *gitid;
    gittag = GITTAG;
    if ((*gittag) && strcmp(gittag, "undefined") != 0)
        gitid = gittag;
    else
        gitid = GITBRANCH;
    return gitid;
}
back to top