- python: add python 2.4 support.

CVS patchset: 7562
CVS date: 2004/11/09 06:59:34
This commit is contained in:
jbj 2004-11-09 06:59:34 +00:00
parent e5e4a65519
commit 487c902d2f
5 changed files with 46 additions and 26 deletions

View File

@ -28,6 +28,7 @@
- bump popt version to 1.10.
- attempt dependency tree breadth, take 1.
- use external libneon for http/https transport.
- python: add python 2.4 support.
4.3.1 -> 4.3.2:
- use /etc/selinux/targeted/contexts/files/file_contexts for now.

View File

@ -817,41 +817,52 @@ AC_ARG_WITH(python, [ --with-python build rpm python bindings ])
WITH_PYTHON_VERSION=$withval
if test $withval = auto ; then
AC_MSG_CHECKING(for python 2.3)
AC_MSG_CHECKING(for python 2.4)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <python2.3/Python.h>
#include <python2.4/Python.h>
main() {
exit(strncmp("2.3", PY_VERSION, 3));
exit(strncmp("2.4", PY_VERSION, 3));
} ]])],[withval=yes],[withval=no],[withval=yes])
AC_MSG_RESULT($withval)
if test $withval = yes ; then
WITH_PYTHON_VERSION="2.3"
WITH_PYTHON_VERSION="2.4"
else
AC_MSG_CHECKING(for python 2.2)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <python2.2/Python.h>
AC_MSG_CHECKING(for python 2.3)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <python2.3/Python.h>
main() {
exit(strncmp("2.2", PY_VERSION, 3));
exit(strncmp("2.3", PY_VERSION, 3));
} ]])],[withval=yes],[withval=no],[withval=yes])
AC_MSG_RESULT($withval)
if test $withval = yes ; then
WITH_PYTHON_VERSION="2.2"
WITH_PYTHON_VERSION="2.3"
else
AC_MSG_CHECKING(for python 1.5.2)
AC_MSG_CHECKING(for python 2.2)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <python1.5/Python.h>
main() {
exit(strcmp("1.5.2", PY_VERSION));
} ]])],[withval=yes],[withval=no],[withval=yes])
#include <python2.2/Python.h>
main() {
exit(strncmp("2.2", PY_VERSION, 3));
} ]])],[withval=yes],[withval=no],[withval=yes])
AC_MSG_RESULT($withval)
if test $withval = yes ; then
WITH_PYTHON_VERSION="1.5"
WITH_PYTHON_VERSION="2.2"
else
AC_MSG_CHECKING(for python 1.5.2)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <python1.5/Python.h>
main() {
exit(strcmp("1.5.2", PY_VERSION));
} ]])],[withval=yes],[withval=no],[withval=yes])
AC_MSG_RESULT($withval)
if test $withval = yes ; then
WITH_PYTHON_VERSION="1.5"
fi
fi
fi
fi
fi
if test "$WITH_PYTHON_VERSION" != no ; then
@ -861,6 +872,7 @@ else
WITH_PYTHON_SUBDIR=
WITH_PYTHON_SUBPACKAGE=0
fi
AC_SUBST(WITH_PYTHON_SUBDIR)
AC_SUBST(WITH_PYTHON_SUBPACKAGE)
AC_SUBST(WITH_PYTHON_VERSION)

View File

@ -7,7 +7,7 @@ LINT = splint
pylibdir = ${prefix}/lib@MARK64@/python@WITH_PYTHON_VERSION@
pyincdir = $(prefix)/include/python@WITH_PYTHON_VERSION@
SUBDIRS = rpmdb # rpm
SUBDIRS = rpmdb rpm
EXTRA_DIST = system.h rpmdebug-py.c
@ -38,16 +38,16 @@ mylibs= \
LDADD =
pythondir = $(pylibdir)/site-packages
python_LTLIBRARIES = rpmmodule.la poptmodule.la
python_LTLIBRARIES = poptmodule.la
#rpmdir = $(pylibdir)/site-packages/rpm
#rpm_LTLIBRARIES = rpmmodule.la
rpmdir = $(pylibdir)/site-packages/rpm
rpm_LTLIBRARIES = _rpmmodule.la
rpmdbdir = $(pylibdir)/site-packages/rpmdb
rpmdb_LTLIBRARIES = _rpmdb.la
rpmmodule_la_LDFLAGS = $(mylibs) $(LIBS) -module -avoid-version
rpmmodule_la_LIBADD = @WITH_BEECRYPT_LIB@
_rpmmodule_la_LDFLAGS = $(mylibs) $(LIBS) -module -avoid-version
_rpmmodule_la_LIBADD = @WITH_BEECRYPT_LIB@
_rpmdb_la_SOURCES = _rpmdb.c
_rpmdb_la_LDFLAGS = $(mylibs) $(LIBS) -module -avoid-version
@ -55,7 +55,7 @@ _rpmdb_la_LDFLAGS = $(mylibs) $(LIBS) -module -avoid-version
poptmodule_la_SOURCES = poptmodule.c
poptmodule_la_LDFLAGS = $(mylibs) $(LIBS) -module -avoid-version
rpmmodule_la_SOURCES = rpmmodule.c header-py.c \
_rpmmodule_la_SOURCES = rpmmodule.c header-py.c \
rpmal-py.c rpmds-py.c rpmdb-py.c rpmfd-py.c rpmfts-py.c \
rpmfi-py.c rpmmi-py.c rpmps-py.c rpmrc-py.c rpmte-py.c \
rpmts-py.c spec-py.c

View File

@ -46,7 +46,9 @@ static const char * lbl(void * s)
if (o->ob_type == &PyCode_Type) return "Code";
if (o->ob_type == &PyComplex_Type) return "Complex";
if (o->ob_type == &PyDict_Type) return "Dict";
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4
if (o->ob_type == &PyDictIter_Type) return "DictIter";
#endif
if (o->ob_type == &PyFile_Type) return "File";
if (o->ob_type == &PyFloat_Type) return "Float";
if (o->ob_type == &PyFrame_Type) return "Frame";

View File

@ -207,6 +207,7 @@ fprintf(stderr, "*** rpmrc_richcompare(%p[%s],%p[%s],%x)\n", v, lbl(v), w, lbl(w
return PyDict_Type.tp_richcompare(v, w, op);
}
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4
/**
*/
static PyObject * rpmrc_iter(PyObject * s)
@ -244,6 +245,10 @@ fprintf(stderr, "*** rpmrc_next(%p[%s],%p)\n", s, lbl(s), args);
return PyDictIter_Type.tp_methods[0].ml_meth(s, args);
return NULL;
}
#else
#define rpmrc_iter 0
#define rpmrc_iternext 0
#endif
/** \ingroup py_c
*/
@ -311,7 +316,7 @@ static struct PyMethodDef rpmrc_methods[] = {
NULL },
{ "delMacro", (PyCFunction) rpmrc_DelMacro, METH_VARARGS,
NULL },
#if Py_TPFLAGS_HAVE_ITER /* XXX backport to python-1.5.2 */
#if Py_TPFLAGS_HAVE_ITER && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4
{ "next", (PyCFunction) rpmrc_next, METH_VARARGS,
"next() -- get the next value, or raise StopIteration"},
#endif