ยปCore Development>Code coverage>Modules/getbuildinfo.c

Python code coverage for Modules/getbuildinfo.c

#countcontent
1n/a#include "Python.h"
2n/a
3n/a#ifndef DONT_HAVE_STDIO_H
4n/a#include <stdio.h>
5n/a#endif
6n/a
7n/a#ifndef DATE
8n/a#ifdef __DATE__
9n/a#define DATE __DATE__
10n/a#else
11n/a#define DATE "xx/xx/xx"
12n/a#endif
13n/a#endif
14n/a
15n/a#ifndef TIME
16n/a#ifdef __TIME__
17n/a#define TIME __TIME__
18n/a#else
19n/a#define TIME "xx:xx:xx"
20n/a#endif
21n/a#endif
22n/a
23n/a/* XXX Only unix build process has been tested */
24n/a#ifndef HGVERSION
25n/a#define HGVERSION ""
26n/a#endif
27n/a#ifndef HGTAG
28n/a#define HGTAG ""
29n/a#endif
30n/a#ifndef HGBRANCH
31n/a#define HGBRANCH ""
32n/a#endif
33n/a
34n/aconst char *
35n/aPy_GetBuildInfo(void)
36n/a{
37n/a static char buildinfo[50 + sizeof(HGVERSION) +
38n/a ((sizeof(HGTAG) > sizeof(HGBRANCH)) ?
39n/a sizeof(HGTAG) : sizeof(HGBRANCH))];
40n/a const char *revision = _Py_hgversion();
41n/a const char *sep = *revision ? ":" : "";
42n/a const char *hgid = _Py_hgidentifier();
43n/a if (!(*hgid))
44n/a hgid = "default";
45n/a PyOS_snprintf(buildinfo, sizeof(buildinfo),
46n/a "%s%s%s, %.20s, %.9s", hgid, sep, revision,
47n/a DATE, TIME);
48n/a return buildinfo;
49n/a}
50n/a
51n/aconst char *
52n/a_Py_hgversion(void)
53n/a{
54n/a return HGVERSION;
55n/a}
56n/a
57n/aconst char *
58n/a_Py_hgidentifier(void)
59n/a{
60n/a const char *hgtag, *hgid;
61n/a hgtag = HGTAG;
62n/a if ((*hgtag) && strcmp(hgtag, "tip") != 0)
63n/a hgid = hgtag;
64n/a else
65n/a hgid = HGBRANCH;
66n/a return hgid;
67n/a}