[Python-checkins] commit of r41772 - in python/trunk: Makefile.pre.in Modules/getbuildinfo.c

barry.warsaw python-checkins at python.org
Mon Dec 19 15:43:48 CET 2005


Author: barry.warsaw
Date: Mon Dec 19 15:43:44 2005
New Revision: 41772

Modified:
   python/trunk/Makefile.pre.in
   python/trunk/Modules/getbuildinfo.c
Log:
Revert most of r41765.  Don't use $Revision$ in Py_GetBuildNumber().  Keep the
use of $(srcdir) in Makefile.pre.in so builds outside the source dir still
work.


Modified: python/trunk/Makefile.pre.in
==============================================================================
--- python/trunk/Makefile.pre.in	(original)
+++ python/trunk/Makefile.pre.in	Mon Dec 19 15:43:44 2005
@@ -351,7 +351,10 @@
 		$(srcdir)/Modules/getbuildinfo.c
 	if test -d $(srcdir)/.svn; then \
 		svnversion $(srcdir) >buildno; \
-	fi
+	elif test -f buildno; then \
+		expr `cat buildno` + 1 >buildno1; \
+		mv -f buildno1 buildno; \
+	else echo 1 >buildno; fi
 
 # Build static library
 # avoid long command lines, same as LIBRARY_OBJS
@@ -443,11 +446,7 @@
 # Special rules for object files
 
 Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
-	if test -f buildno; then \
-		$(CC) -c $(PY_CFLAGS) -DBUILD=\"`cat buildno`\" -o $@ $(srcdir)/Modules/getbuildinfo.c ;\
-	else \
-		$(CC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/getbuildinfo.c ;\
-	fi
+	$(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)"' \

Modified: python/trunk/Modules/getbuildinfo.c
==============================================================================
--- python/trunk/Modules/getbuildinfo.c	(original)
+++ python/trunk/Modules/getbuildinfo.c	Mon Dec 19 15:43:44 2005
@@ -21,38 +21,20 @@
 #endif
 
 #ifndef BUILD
-#define BUILD "$Revision$"
+#define BUILD "0"
 #endif
 
 const char *
-Py_GetBuildNumber(void)
-{
-	static char buildno[20];
-	static int buildno_okay;
-
-	if (!buildno_okay) {
-		char *build = BUILD;
-		int len = strlen(build);
-
-		if (len > 13 &&
-		    !strncmp(build, "$Revision: ", 11) &&
-		    !strcmp(build + len - 2, " $"))
-		{
-			memcpy(buildno, build + 11, len - 13);
-		}
-		else {
-			memcpy(buildno, build, 19);
-		}
-		buildno_okay = 1;
-	}
-	return buildno;
-}
-
-const char *
 Py_GetBuildInfo(void)
 {
 	static char buildinfo[50];
 	PyOS_snprintf(buildinfo, sizeof(buildinfo),
-		      "#%s, %.20s, %.9s", Py_GetBuildNumber(), DATE, TIME);
+		      "%s, %.20s, %.9s", BUILD, DATE, TIME);
 	return buildinfo;
 }
+
+const char *
+Py_GetBuildNumber(void)
+{
+	return BUILD;
+}


More information about the Python-checkins mailing list