summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2005-12-18 01:27:35 (GMT)
committerBarry Warsaw <barry@python.org>2005-12-18 01:27:35 (GMT)
commit2a38a86c1c48adbf9cf76d485c515002f042fd56 (patch)
tree728b60b9fdc895f23a1a18dca41d49ce38a5ce62 /Modules
parent11ca77e6deb795a697ce00849c2f081e9bdbabb7 (diff)
downloadcpython-2a38a86c1c48adbf9cf76d485c515002f042fd56.zip
cpython-2a38a86c1c48adbf9cf76d485c515002f042fd56.tar.gz
cpython-2a38a86c1c48adbf9cf76d485c515002f042fd56.tar.bz2
Expose Subversion revision number (calculated via "svnversion .") to Python.
Add C API function Py_GetBuildNumber(), add it to the interactive prompt banner (i.e. Py_GetBuildInfo()), and add it as the sys.build_number attribute. The build number is a string instead of an int because it may contain a trailing 'M' if there are local modifications.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/getbuildinfo.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
index b541bb6..8b1ca22 100644
--- a/Modules/getbuildinfo.c
+++ b/Modules/getbuildinfo.c
@@ -21,7 +21,7 @@
#endif
#ifndef BUILD
-#define BUILD 0
+#define BUILD "0"
#endif
const char *
@@ -29,6 +29,12 @@ Py_GetBuildInfo(void)
{
static char buildinfo[50];
PyOS_snprintf(buildinfo, sizeof(buildinfo),
- "#%d, %.20s, %.9s", BUILD, DATE, TIME);
+ "%s, %.20s, %.9s", BUILD, DATE, TIME);
return buildinfo;
}
+
+const char *
+Py_GetBuildNumber(void)
+{
+ return BUILD;
+}