[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r12557 - in trunk: build/ac-macros subversion subversion/bindings/swig subversion/bindings/swig/python/libsvn_swig_py

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2005-01-02 20:19:27 CET

Hi Max,

This commit not only breaks python bindings on Windows, but configure
on many systems.

On Sun, 2 Jan 2005 06:28:35 -0600, maxb@tigris.org <maxb@tigris.org> wrote:
> Author: maxb
> Date: Sun Jan 2 06:28:32 2005
> New Revision: 12557
>
> Modified:
> trunk/build/ac-macros/swig.m4
> trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
> trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
> trunk/subversion/bindings/swig/svn_client.i
> trunk/subversion/svn_private_config.hw
> Log:
> Python bindings: Make svn_client_blame() usable, by thunking the callback.
>
> ATTENTION: This breaks the Windows Python bindings build!
> I have left what I believe to be the appropriate fix commented out in
> svn_private_config.hw, for someone who can test it to review and uncomment.
>
> * build/ac-macros/swig.m4: Deduce the appropriate Python/C API format character
> for apr_int64_t, and define it in svn_private_config.h.
> * subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c:
> Include svn_private_config.h.
> (svn_swig_py_client_blame_receiver_func): New function.
> * subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h:
> (svn_swig_py_client_blame_receiver_func): Declare new function.
> * subversion/bindings/swig/svn_client.i: New typemap, using the new function.
> * subversion/svn_private_config.hw: Add info to help someone fix the Windows
> build.
>
> Modified: trunk/build/ac-macros/swig.m4
> Url: http://svn.collab.net/viewcvs/svn/trunk/build/ac-macros/swig.m4?view=diff&rev=12557&p1=trunk/build/ac-macros/swig.m4&r1=12556&p2=trunk/build/ac-macros/swig.m4&r2=12557
> ==============================================================================
> --- trunk/build/ac-macros/swig.m4 (original)
> +++ trunk/build/ac-macros/swig.m4 Sun Jan 2 06:28:32 2005
> @@ -164,6 +164,35 @@
> ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py --libs`"
> ])
> SWIG_PY_LIBS="$ac_cv_python_libs"
> +
> + AC_CACHE_CHECK([for apr_int64_t Python/C API format string],
> + [svn_cv_pycfmt_apr_int64_t], [
> + if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
> + AC_EGREP_CPP([MaTcHtHiS \"lld\" EnDeNd],
> + [#include <apr.h>
> + MaTcHtHiS APR_INT64_T_FMT EnDeNd],
> + [svn_cv_pycfmt_apr_int64_t="L"])
> + fi

This and the ones below don't take the --with-apr parameter in
consideration, meaning this only works if you install the headers into
a standard location. I use /usr/local/apr (APR's default) which means
the headers are in /usr/local/apr/include/apr-0/. configure fails to
add them to the CPP call.

> + if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
> + AC_EGREP_CPP([MaTcHtHiS \"ld\" EnDeNd],r
> + [#include <apr.h>
> + MaTcHtHiS APR_INT64_T_FMT EnDeNd],
> + [svn_cv_pycfmt_apr_int64_t="l"])
> + fi
> + if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
> + AC_EGREP_CPP([MaTcHtHiS \"d\" EnDeNd],
> + [#include <apr.h>
> + MaTcHtHiS APR_INT64_T_FMT EnDeNd],
> + [svn_cv_pycfmt_apr_int64_t="i"])
> + fi
> + ])
> + if test "x$svn_cv_pycfmt_apr_int64_t" = "x"; then
> + AC_MSG_ERROR([failed to recognize APR_INT64_T_FMT on this platform])
> + fi
> + AC_DEFINE_UNQUOTED([SVN_APR_INT64_T_PYCFMT],
> + ["$svn_cv_pycfmt_apr_int64_t"],
> + [Define to the Python/C API format character suitable]
> + [ for apr_int64_t])
> fi
>
> if test "$JDK" != "none" -a "$SWIG_SUITABLE" = "yes" -a "$svn_swig_bindings_enable_java" = "yes"; then
>
> Modified: trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c?view=diff&rev=12557&p1=trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c&r1=12556&p2=trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c&r2=12557
> ==============================================================================
> --- trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (original)
> +++ trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c Sun Jan 2 06:28:32 2005
> @@ -33,6 +33,8 @@
> #include "svn_delta.h"
> #include "svn_auth.h"
>
> +#include "svn_private_config.h" /* for SVN_APR_INT64_T_PYCFMT */
> +
> #include "swigutil_py.h"
>
> @@ -1388,6 +1390,43 @@
> }
>
> Py_DECREF(chpaths);
> + svn_swig_py_release_py_lock();
> + return err;
> +}
> +
> +
> +svn_error_t *svn_swig_py_client_blame_receiver_func(void *baton,
> + apr_int64_t line_no,
> + svn_revnum_t revision,
> + const char *author,
> + const char *date,
> + const char *line,
> + apr_pool_t *pool)
> +{
> + PyObject *receiver = baton;
> + PyObject *result;
> + svn_error_t *err = SVN_NO_ERROR;
> +
> + if ((receiver == NULL) || (receiver == Py_None))
> + return SVN_NO_ERROR;
> +
> + svn_swig_py_acquire_py_lock();
> +
> + if ((result = PyObject_CallFunction(receiver,
> + (char *)
> + (SVN_APR_INT64_T_PYCFMT "lsssO&"),
> + line_no, revision, author, date, line,
> + make_ob_pool, pool)) == NULL)
> + {
> + err = callback_exception_error();
> + }
> + else
> + {
> + if (result != Py_None)
> + err = callback_bad_return_error("Not None");
> + Py_DECREF(result);
> + }
> +
> svn_swig_py_release_py_lock();
> return err;
> }
>
> Modified: trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h?view=diff&rev=12557&p1=trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h&r1=12556&p2=trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h&r2=12557
> ==============================================================================
> --- trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h (original)
> +++ trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h Sun Jan 2 06:28:32 2005
> @@ -179,6 +179,15 @@
> const char *msg,
> apr_pool_t *pool);
>
> +/* thunked blame receiver function */
> +svn_error_t *svn_swig_py_client_blame_receiver_func(void *baton,
> + apr_int64_t line_no,
> + svn_revnum_t revision,
> + const char *author,
> + const char *date,
> + const char *line,
> + apr_pool_t *pool);
> +
> /* auth provider callbacks */
> svn_error_t *svn_swig_py_auth_simple_prompt_func(
> svn_auth_cred_simple_t **cred,
>
> Modified: trunk/subversion/bindings/swig/svn_client.i
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/bindings/swig/svn_client.i?view=diff&rev=12557&p1=trunk/subversion/bindings/swig/svn_client.i&r1=12556&p2=trunk/subversion/bindings/swig/svn_client.i&r2=12557
> ==============================================================================
> --- trunk/subversion/bindings/swig/svn_client.i (original)
> +++ trunk/subversion/bindings/swig/svn_client.i Sun Jan 2 06:28:32 2005
> @@ -219,6 +219,12 @@
> handle svn_client_blame_receiver_t/baton pairs
> */
>
> +%typemap(python, in) (svn_client_blame_receiver_t receiver,
> + void *receiver_baton) {
> + $1 = svn_swig_py_client_blame_receiver_func;
> + $2 = (void *)$input;
> +}
> +
> %typemap(perl5,in) (svn_client_blame_receiver_t receiver, void *receiver_baton) {
> $1 = svn_swig_pl_blame_func;
> $2 = $input; /* our function is the baton. */
>
> Modified: trunk/subversion/svn_private_config.hw
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/svn_private_config.hw?view=diff&rev=12557&p1=trunk/subversion/svn_private_config.hw&r1=12556&p2=trunk/subversion/svn_private_config.hw&r2=12557
> ==============================================================================
> --- trunk/subversion/svn_private_config.hw (original)
> +++ trunk/subversion/svn_private_config.hw Sun Jan 2 06:28:32 2005
> @@ -54,6 +54,22 @@
> /* Defined to be the path to the installed binaries */
> #define SVN_BINARY_DIR "/usr/local/bin"
>
> +/* Define to the Python/C API format character suitable for apr_int64_t */
> +/*
> + * FIXME: The Windows Python bindings build is currently broken.
> + * Uncommenting the below should probably be sufficient to fix things,
> + * but since I don't have a Windows build environment to test, I am just
> + * breaking things and leaving this hint to help someone who does.
> + *
> + * #ifdef _WIN64
> + * #define SVN_APR_INT64_T_PYCFMT "l"
> + * #else
> + * #ifdef _WIN32
> + * #define SVN_APR_INT64_T_PYCFMT "L"
> + * #endif
> + * #endif
> + */
> +
> /* Setup gettext macros */
> #define N_(x) x
> #define PACKAGE_NAME "subversion"

bye,

Erik.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jan 2 20:20:54 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.