summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-01-05 10:00:36 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-01-05 10:00:36 (GMT)
commitdea59e5755526be328aa6d330ce730e387a7562d (patch)
treeb2b05d27be8170b1e28df4d570e1e12b41946d9f
parentc6d1f9100f8cb80dec5b1a454d3bdb54f6f76f98 (diff)
downloadcpython-dea59e5755526be328aa6d330ce730e387a7562d.zip
cpython-dea59e5755526be328aa6d330ce730e387a7562d.tar.gz
cpython-dea59e5755526be328aa6d330ce730e387a7562d.tar.bz2
Stop maintaining the buildno file.
Also, stop determining Unicode sizes with PyString_GET_SIZE.
-rw-r--r--Makefile.pre.in28
-rw-r--r--Modules/getbuildinfo.c19
-rw-r--r--Objects/unicodeobject.c27
-rwxr-xr-xconfigure48
-rw-r--r--configure.in3
5 files changed, 88 insertions, 37 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 507399b..3d08837 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -33,6 +33,7 @@ CXX= @CXX@
LINKCC= @LINKCC@
AR= @AR@
RANLIB= @RANLIB@
+SVNVERSION= @SVNVERSION@
# Shell used by make (some versions default to the login shell, which is bad)
SHELL= /bin/sh
@@ -341,21 +342,6 @@ sharedmods: $(BUILDPYTHON)
*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
esac
-# buildno should really depend on something like LIBRARY_SRC
-buildno: $(PARSER_OBJS) \
- $(OBJECT_OBJS) \
- $(PYTHON_OBJS) \
- $(MODULE_OBJS) \
- $(SIGNAL_OBJS) \
- $(MODOBJS) \
- $(srcdir)/Modules/getbuildinfo.c
- if test -d $(srcdir)/.svn -a "`which svnversion 2> /dev/null`"; then \
- svnversion $(srcdir) >buildno; \
- 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
$(LIBRARY): $(LIBRARY_OBJS)
@@ -445,8 +431,14 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist
############################################################################
# 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
+Modules/getbuildinfo.o: $(PARSER_OBJS) \
+ $(OBJECT_OBJS) \
+ $(PYTHON_OBJS) \
+ $(MODULE_OBJS) \
+ $(SIGNAL_OBJS) \
+ $(MODOBJS) \
+ $(srcdir)/Modules/getbuildinfo.c
+ $(CC) -c $(PY_CFLAGS) -DSVNVERSION=\"`LANG=C $(SVNVERSION) $(srcdir)`\" -o $@ $(srcdir)/Modules/getbuildinfo.c
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
@@ -990,7 +982,7 @@ clobber: clean
# remove all generated files, even Makefile[.pre]
# Keep configure and Python-ast.[ch], it's possible they can't be generated
distclean: clobber
- -rm -f core Makefile Makefile.pre buildno config.status \
+ -rm -f core Makefile Makefile.pre config.status \
Modules/Setup Modules/Setup.local Modules/Setup.config
find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
-o -name '[@,#]*' -o -name '*.old' \
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
index 8b1ca22..7343a0f 100644
--- a/Modules/getbuildinfo.c
+++ b/Modules/getbuildinfo.c
@@ -20,21 +20,30 @@
#endif
#endif
-#ifndef BUILD
-#define BUILD "0"
-#endif
+static const char revision[] = "$Revision$";
+static const char headurl[] = "$HeadURL$";
const char *
Py_GetBuildInfo(void)
{
static char buildinfo[50];
+#ifdef SVNVERSION
+ static char svnversion[] = SVNVERSION;
+#else
+ static char svnversion[20] = "unknown";
+ if (strstr(headurl, "/tags/") != NULL) {
+ int start = ;
+ strncpy(svnversion, revision+start, stop-start);
+ svnversion[stop-start] = '\0';
+ }
+#endif
PyOS_snprintf(buildinfo, sizeof(buildinfo),
- "%s, %.20s, %.9s", BUILD, DATE, TIME);
+ "%s, %.20s, %.9s", svnversion, DATE, TIME);
return buildinfo;
}
const char *
Py_GetBuildNumber(void)
{
- return BUILD;
+ return "0";
}
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index b850559..15d647e 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5357,7 +5357,7 @@ unicode_islower(PyUnicodeObject *self)
return PyBool_FromLong(Py_UNICODE_ISLOWER(*p));
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5391,7 +5391,7 @@ unicode_isupper(PyUnicodeObject *self)
return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5428,7 +5428,7 @@ unicode_istitle(PyUnicodeObject *self)
(Py_UNICODE_ISUPPER(*p) != 0));
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5473,7 +5473,7 @@ unicode_isspace(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5502,7 +5502,7 @@ unicode_isalpha(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5531,7 +5531,7 @@ unicode_isalnum(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5560,7 +5560,7 @@ unicode_isdecimal(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5589,7 +5589,7 @@ unicode_isdigit(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -5618,7 +5618,7 @@ unicode_isnumeric(PyUnicodeObject *self)
return PyBool_FromLong(1);
/* Special case for empty strings */
- if (PyString_GET_SIZE(self) == 0)
+ if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self);
@@ -6453,14 +6453,14 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
if (PyInt_Check(item)) {
long i = PyInt_AS_LONG(item);
if (i < 0)
- i += PyString_GET_SIZE(self);
+ i += PyUnicode_GET_SIZE(self);
return unicode_getitem(self, i);
} else if (PyLong_Check(item)) {
long i = PyLong_AsLong(item);
if (i == -1 && PyErr_Occurred())
return NULL;
if (i < 0)
- i += PyString_GET_SIZE(self);
+ i += PyUnicode_GET_SIZE(self);
return unicode_getitem(self, i);
} else if (PySlice_Check(item)) {
int start, stop, step, slicelength, cur, i;
@@ -6468,7 +6468,7 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
Py_UNICODE* result_buf;
PyObject* result;
- if (PySlice_GetIndicesEx((PySliceObject*)item, PyString_GET_SIZE(self),
+ if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self),
&start, &stop, &step, &slicelength) < 0) {
return NULL;
}
@@ -6478,6 +6478,9 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
} else {
source_buf = PyUnicode_AS_UNICODE((PyObject*)self);
result_buf = PyMem_MALLOC(slicelength*sizeof(Py_UNICODE));
+
+ if (result_buf == NULL)
+ return PyErr_NoMemory();
for (cur = start, i = 0; i < slicelength; cur += step, i++) {
result_buf[i] = source_buf[cur];
diff --git a/configure b/configure
index 179259d..d36537f 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 41764 .
+# From configure.in Revision: 41852 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for python 2.5.
#
@@ -312,7 +312,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR SVNVERSION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -3575,6 +3575,49 @@ done
test -n "$AR" || AR="ar"
+
+for ac_prog in svnversion
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_SVNVERSION+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$SVNVERSION"; then
+ ac_cv_prog_SVNVERSION="$SVNVERSION" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_SVNVERSION="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+SVNVERSION=$ac_cv_prog_SVNVERSION
+if test -n "$SVNVERSION"; then
+ echo "$as_me:$LINENO: result: $SVNVERSION" >&5
+echo "${ECHO_T}$SVNVERSION" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$SVNVERSION" && break
+done
+test -n "$SVNVERSION" || SVNVERSION="echo no svnversion"
+
+
case $MACHDEP in
bsdos*|hp*|HP*)
# install -d does not work on BSDI or HP-UX
@@ -21477,6 +21520,7 @@ s,@LINKCC@,$LINKCC,;t t
s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@AR@,$AR,;t t
+s,@SVNVERSION@,$SVNVERSION,;t t
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
s,@INSTALL_DATA@,$INSTALL_DATA,;t t
diff --git a/configure.in b/configure.in
index 8f7dd8c..16368a7 100644
--- a/configure.in
+++ b/configure.in
@@ -618,6 +618,9 @@ AC_PROG_RANLIB
AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar)
+AC_SUBST(SVNVERSION)
+AC_CHECK_PROGS(SVNVERSION, svnversion, [echo no svnversion])
+
case $MACHDEP in
bsdos*|hp*|HP*)
# install -d does not work on BSDI or HP-UX