\withsubitem{(in module sys)}{\ttindex{version}}
\end{cfuncdesc}
+\begin{cfuncdesc}{const char*}{Py_GetBuildNumber}{}
+ Return a string representing the Subversion revision that this Python
+ executable was built from. This number is a string because it may contain a
+ trailing 'M' if Python was built from a mixed revision source tree.
+\end{cfuncdesc}
+
\begin{cfuncdesc}{const char*}{Py_GetPlatform}{}
Return the platform identifier for the current platform. On \UNIX,
this is formed from the ``official'' name of the operating system,
\versionadded{2.0}
\end{datadesc}
+\begin{datadesc}{build_number}
+ A string representing the Subversion revision that this Python executable
+ was built from. This number is a string because it may contain a trailing
+ 'M' if Python was built from a mixed revision source tree.
+\end{datadesc}
+
\begin{datadesc}{builtin_module_names}
A tuple of strings giving the names of all modules that are compiled
into this Python interpreter. (This information is not available in
PyAPI_FUNC(const char *) Py_GetCopyright(void);
PyAPI_FUNC(const char *) Py_GetCompiler(void);
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
+PyAPI_FUNC(const char *) Py_GetBuildNumber(void);
/* Internal -- various one-time initializations */
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
$(SIGNAL_OBJS) \
$(MODOBJS) \
$(srcdir)/Modules/getbuildinfo.c
- if test -f buildno; then \
+ if test -d .svn; then \
+ svnversion . >buildno; \
+ elif test -f buildno; then \
expr `cat buildno` + 1 >buildno1; \
mv -f buildno1 buildno; \
else echo 1 >buildno; fi
# Special rules for object files
Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
- $(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
+ $(CC) -c $(PY_CFLAGS) -DBUILD=\"`cat buildno`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
Core and builtins
-----------------
+- Patch #1382163: Expose Subversion revision number to Python. New C API
+ function Py_GetBuildNumber(). New attribute sys.build_number. Build number
+ is now displayed in interactive prompt banner.
+
- Implementation of PEP 341 - Unification of try/except and try/finally.
"except" clauses can now be written together with a "finally" clause in
one try statement instead of two nested ones. Patch #1355913.
#endif
#ifndef BUILD
-#define BUILD 0
+#define BUILD "0"
#endif
const char *
{
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;
+}
PyDict_SetItemString(sysdict, "hexversion",
v = PyInt_FromLong(PY_VERSION_HEX));
Py_XDECREF(v);
+ PyDict_SetItemString(sysdict, "build_number",
+ v = PyString_FromString(Py_GetBuildNumber()));
+ Py_XDECREF(v);
/*
* These release level checks are mutually exclusive and cover
* the field, so don't get too fancy with the pre-processor!