blob: 3bac1c50c443fde31597c68342129f08b2999037 [file] [log] [blame]
Tim Peters22a51ef2001-12-04 01:11:32 +00001#include "Python.h"
Guido van Rossum49bff651997-05-20 22:40:26 +00002
Guido van Rossumff7e83d1999-08-27 20:39:37 +00003#ifndef DONT_HAVE_STDIO_H
Guido van Rossum2fff2e61997-01-20 18:34:26 +00004#include <stdio.h>
Guido van Rossumff7e83d1999-08-27 20:39:37 +00005#endif
Guido van Rossum2fff2e61997-01-20 18:34:26 +00006
7#ifndef DATE
8#ifdef __DATE__
9#define DATE __DATE__
10#else
11#define DATE "xx/xx/xx"
12#endif
13#endif
14
15#ifndef TIME
16#ifdef __TIME__
17#define TIME __TIME__
18#else
19#define TIME "xx:xx:xx"
20#endif
21#endif
22
Guido van Rossumcd16bf62007-06-13 18:07:49 +000023/* on unix, SVNVERSION is passed on the command line.
24 * on Windows, the string is interpolated using
25 * subwcrev.exe
26 */
27#ifndef SVNVERSION
Martin v. Löwisd078e402006-01-18 09:13:51 +000028#define SVNVERSION "$WCRANGE$$WCMODS?M:$"
Guido van Rossumcd16bf62007-06-13 18:07:49 +000029#endif
30
Guido van Rossum2fff2e61997-01-20 18:34:26 +000031const char *
Thomas Woutersf3f33dc2000-07-21 06:00:07 +000032Py_GetBuildInfo(void)
Guido van Rossum2fff2e61997-01-20 18:34:26 +000033{
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000034 static char buildinfo[50];
35 const char *revision = Py_SubversionRevision();
36 const char *sep = *revision ? ":" : "";
37 const char *branch = Py_SubversionShortBranch();
38 PyOS_snprintf(buildinfo, sizeof(buildinfo),
39 "%s%s%s, %.20s, %.9s", branch, sep, revision,
40 DATE, TIME);
41 return buildinfo;
Guido van Rossum2fff2e61997-01-20 18:34:26 +000042}
Barry Warsawce3a9132005-12-19 14:43:44 +000043
44const char *
Martin v. Löwis43b57802006-01-05 23:38:54 +000045_Py_svnversion(void)
Barry Warsawce3a9132005-12-19 14:43:44 +000046{
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000047 /* the following string can be modified by subwcrev.exe */
48 static const char svnversion[] = SVNVERSION;
49 if (svnversion[0] != '$')
50 return svnversion; /* it was interpolated, or passed on command line */
51 return "Unversioned directory";
Barry Warsawce3a9132005-12-19 14:43:44 +000052}