Stop maintaining the buildno file.

Also, stop determining Unicode sizes with PyString_GET_SIZE.
This commit is contained in:
Martin v. Löwis 2006-01-05 10:00:36 +00:00
parent c6d1f9100f
commit dea59e5755
5 changed files with 88 additions and 37 deletions

View File

@ -33,6 +33,7 @@ CXX= @CXX@
LINKCC= @LINKCC@ LINKCC= @LINKCC@
AR= @AR@ AR= @AR@
RANLIB= @RANLIB@ RANLIB= @RANLIB@
SVNVERSION= @SVNVERSION@
# Shell used by make (some versions default to the login shell, which is bad) # Shell used by make (some versions default to the login shell, which is bad)
SHELL= /bin/sh SHELL= /bin/sh
@ -341,21 +342,6 @@ sharedmods: $(BUILDPYTHON)
*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
esac 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 # Build static library
# avoid long command lines, same as LIBRARY_OBJS # avoid long command lines, same as LIBRARY_OBJS
$(LIBRARY): $(LIBRARY_OBJS) $(LIBRARY): $(LIBRARY_OBJS)
@ -445,8 +431,14 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist
############################################################################ ############################################################################
# Special rules for object files # Special rules for object files
Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno Modules/getbuildinfo.o: $(PARSER_OBJS) \
$(CC) -c $(PY_CFLAGS) -DBUILD=\"`cat buildno`\" -o $@ $(srcdir)/Modules/getbuildinfo.c $(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 Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \ $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
@ -990,7 +982,7 @@ clobber: clean
# remove all generated files, even Makefile[.pre] # remove all generated files, even Makefile[.pre]
# Keep configure and Python-ast.[ch], it's possible they can't be generated # Keep configure and Python-ast.[ch], it's possible they can't be generated
distclean: clobber 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 Modules/Setup Modules/Setup.local Modules/Setup.config
find $(srcdir) '(' -name '*.fdc' -o -name '*~' \ find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
-o -name '[@,#]*' -o -name '*.old' \ -o -name '[@,#]*' -o -name '*.old' \

View File

@ -20,21 +20,30 @@
#endif #endif
#endif #endif
#ifndef BUILD static const char revision[] = "$Revision$";
#define BUILD "0" static const char headurl[] = "$HeadURL$";
#endif
const char * const char *
Py_GetBuildInfo(void) Py_GetBuildInfo(void)
{ {
static char buildinfo[50]; 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), PyOS_snprintf(buildinfo, sizeof(buildinfo),
"%s, %.20s, %.9s", BUILD, DATE, TIME); "%s, %.20s, %.9s", svnversion, DATE, TIME);
return buildinfo; return buildinfo;
} }
const char * const char *
Py_GetBuildNumber(void) Py_GetBuildNumber(void)
{ {
return BUILD; return "0";
} }

View File

@ -5357,7 +5357,7 @@ unicode_islower(PyUnicodeObject *self)
return PyBool_FromLong(Py_UNICODE_ISLOWER(*p)); return PyBool_FromLong(Py_UNICODE_ISLOWER(*p));
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5391,7 +5391,7 @@ unicode_isupper(PyUnicodeObject *self)
return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0); return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5428,7 +5428,7 @@ unicode_istitle(PyUnicodeObject *self)
(Py_UNICODE_ISUPPER(*p) != 0)); (Py_UNICODE_ISUPPER(*p) != 0));
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5473,7 +5473,7 @@ unicode_isspace(PyUnicodeObject *self)
return PyBool_FromLong(1); return PyBool_FromLong(1);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5502,7 +5502,7 @@ unicode_isalpha(PyUnicodeObject *self)
return PyBool_FromLong(1); return PyBool_FromLong(1);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5531,7 +5531,7 @@ unicode_isalnum(PyUnicodeObject *self)
return PyBool_FromLong(1); return PyBool_FromLong(1);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5560,7 +5560,7 @@ unicode_isdecimal(PyUnicodeObject *self)
return PyBool_FromLong(1); return PyBool_FromLong(1);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5589,7 +5589,7 @@ unicode_isdigit(PyUnicodeObject *self)
return PyBool_FromLong(1); return PyBool_FromLong(1);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -5618,7 +5618,7 @@ unicode_isnumeric(PyUnicodeObject *self)
return PyBool_FromLong(1); return PyBool_FromLong(1);
/* Special case for empty strings */ /* Special case for empty strings */
if (PyString_GET_SIZE(self) == 0) if (PyUnicode_GET_SIZE(self) == 0)
return PyBool_FromLong(0); return PyBool_FromLong(0);
e = p + PyUnicode_GET_SIZE(self); e = p + PyUnicode_GET_SIZE(self);
@ -6453,14 +6453,14 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
if (PyInt_Check(item)) { if (PyInt_Check(item)) {
long i = PyInt_AS_LONG(item); long i = PyInt_AS_LONG(item);
if (i < 0) if (i < 0)
i += PyString_GET_SIZE(self); i += PyUnicode_GET_SIZE(self);
return unicode_getitem(self, i); return unicode_getitem(self, i);
} else if (PyLong_Check(item)) { } else if (PyLong_Check(item)) {
long i = PyLong_AsLong(item); long i = PyLong_AsLong(item);
if (i == -1 && PyErr_Occurred()) if (i == -1 && PyErr_Occurred())
return NULL; return NULL;
if (i < 0) if (i < 0)
i += PyString_GET_SIZE(self); i += PyUnicode_GET_SIZE(self);
return unicode_getitem(self, i); return unicode_getitem(self, i);
} else if (PySlice_Check(item)) { } else if (PySlice_Check(item)) {
int start, stop, step, slicelength, cur, i; int start, stop, step, slicelength, cur, i;
@ -6468,7 +6468,7 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
Py_UNICODE* result_buf; Py_UNICODE* result_buf;
PyObject* result; 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) { &start, &stop, &step, &slicelength) < 0) {
return NULL; return NULL;
} }
@ -6479,6 +6479,9 @@ unicode_subscript(PyUnicodeObject* self, PyObject* item)
source_buf = PyUnicode_AS_UNICODE((PyObject*)self); source_buf = PyUnicode_AS_UNICODE((PyObject*)self);
result_buf = PyMem_MALLOC(slicelength*sizeof(Py_UNICODE)); 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++) { for (cur = start, i = 0; i < slicelength; cur += step, i++) {
result_buf[i] = source_buf[cur]; result_buf[i] = source_buf[cur];
} }

48
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 41764 . # From configure.in Revision: 41852 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for python 2.5. # Generated by GNU Autoconf 2.59 for python 2.5.
# #
@ -312,7 +312,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #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='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
@ -3575,6 +3575,49 @@ done
test -n "$AR" || AR="ar" 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 case $MACHDEP in
bsdos*|hp*|HP*) bsdos*|hp*|HP*)
# install -d does not work on BSDI or HP-UX # 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,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@AR@,$AR,;t t s,@AR@,$AR,;t t
s,@SVNVERSION@,$SVNVERSION,;t t
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t

View File

@ -618,6 +618,9 @@ AC_PROG_RANLIB
AC_SUBST(AR) AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar) AC_CHECK_PROGS(AR, ar aal, ar)
AC_SUBST(SVNVERSION)
AC_CHECK_PROGS(SVNVERSION, svnversion, [echo no svnversion])
case $MACHDEP in case $MACHDEP in
bsdos*|hp*|HP*) bsdos*|hp*|HP*)
# install -d does not work on BSDI or HP-UX # install -d does not work on BSDI or HP-UX