You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by jw...@apache.org on 2010/01/22 23:13:32 UTC
svn commit: r902293 - in /subversion/trunk: build/run_ctypesgen.sh
subversion/bindings/ctypes-python/csvn/core/functions.py.in
subversion/bindings/ctypes-python/setup.py
Author: jwhitlock
Date: Fri Jan 22 22:13:31 2010
New Revision: 902293
URL: http://svn.apache.org/viewvc?rev=902293&view=rev
Log:
Fixed various issues related to ctypes-python from library loading order to
64-bit int truncation.
* build/run_ctypesgen.sh: Changed the order of the libraries passed to
ctypesgen.py so that the Subversion lib directory is searched first to
avoid problems where Subversion libs providied by the system are also
in the same directories apr/apr-util are, like on OS X.
* subversion/bindings/ctypes-python/setup.py
(build_functions_py): Replaced SVN_ERR return types with new type that will
note cause truncating from 64-bit int to 32-bit int.
* subversion/bindings/ctypes-python/csvn/core/functions.py.in
(_svn_errcheck): Added.
Modified:
subversion/trunk/build/run_ctypesgen.sh
subversion/trunk/subversion/bindings/ctypes-python/csvn/core/functions.py.in
subversion/trunk/subversion/bindings/ctypes-python/setup.py
Modified: subversion/trunk/build/run_ctypesgen.sh
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_ctypesgen.sh?rev=902293&r1=902292&r2=902293&view=diff
==============================================================================
--- subversion/trunk/build/run_ctypesgen.sh (original)
+++ subversion/trunk/build/run_ctypesgen.sh Fri Jan 22 22:13:31 2010
@@ -61,7 +61,7 @@
### end
cppflags="$apr_cppflags $apu_cppflags -I$svn_includes"
-ldflags="$apr_ldflags $apu_ldflags -L$svn_libdir $EXTRA_CTYPES_LDFLAGS"
+ldflags="-L$svn_libdir $apr_ldflags $apu_ldflags $EXTRA_CTYPES_LDFLAGS"
# This order is important. The resulting stubs will load libraries in
@@ -84,6 +84,6 @@
$LT_EXECUTE $PYTHON $CTYPESGEN --cpp "$cpp $CPPFLAGS $cppflags" $ldflags $includes -o $output --no-macro-warnings --strip-build-path=$abs_srcdir
(cat $abs_srcdir/$cp_relpath/csvn/core/functions.py.in; \
- sed -e '/^FILE =/d' \
- -e 's/restype = POINTER(svn_error_t)/restype = SVN_ERR/' $output \
+ sed -e '/^FILE =/d' $output | \
+ perl -pe 's{(\s+\w+)\.restype = POINTER\(svn_error_t\)}{\1.restype = POINTER(svn_error_t)\n\1.errcheck = _svn_errcheck}' \
) > $abs_builddir/$cp_relpath/csvn/core/functions.py
Modified: subversion/trunk/subversion/bindings/ctypes-python/csvn/core/functions.py.in
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/ctypes-python/csvn/core/functions.py.in?rev=902293&r1=902292&r2=902293&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/ctypes-python/csvn/core/functions.py.in (original)
+++ subversion/trunk/subversion/bindings/ctypes-python/csvn/core/functions.py.in Fri Jan 22 22:13:31 2010
@@ -65,6 +65,11 @@
raise SubversionException(err)
return ret
+# If a error is returned from a Subversion function,
+# raise an exception
+def _svn_errcheck(result, func, args):
+ return SVN_ERR(result)
+
# As of ctypes 1.0, ctypes does not support custom error-checking
# functions on callbacks, nor does it support custom datatypes on
# callbacks, so ctypesgen sets the return values for callbacks
Modified: subversion/trunk/subversion/bindings/ctypes-python/setup.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/ctypes-python/setup.py?rev=902293&r1=902292&r2=902293&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/ctypes-python/setup.py (original)
+++ subversion/trunk/subversion/bindings/ctypes-python/setup.py Fri Jan 22 22:13:31 2010
@@ -254,10 +254,10 @@
sys.exit(2)
if not self.dry_run:
+ r = re.compile(r"(\s+\w+)\.restype = POINTER\(svn_error_t\)")
out = open("svn_all2.py", "w")
for line in open("svn_all.py"):
- line = line.replace("restype = POINTER(svn_error_t)",
- "restype = SVN_ERR")
+ line = r.sub("\\1.restype = POINTER(svn_error_t)\n\\1.errcheck = _svn_errcheck", line)
if not line.startswith("FILE ="):
out.write(line)