header_wrappers.py

Checkout Tools
  • last updated 41 mins ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Merge the swig-py3 branch to trunk.
  1. … 61 more files in changeset.
When the build system writes an automatically generated file, say what

program generated it and, when applicable, from which source file, to help

us navigate around the build system. We were doing so in some but not all

cases.

* build/generator/gen_make.py

(Generator): Refer to this program in transform_libtool_scripts.sh and

autogen-standalone.mk, and to 'build-outputs.mk' in the latter.

* build/generator/swig/header_wrappers.py

(Generator): Refer to this program in the header wrapper files. (It

was already referring to the source header file.)

* tools/dev/gen-py-errors.py

(HEADER): Correct the name of this program, as written to stdout.

  1. … 2 more files in changeset.
Cause 'make swig-pl' to trigger the 'SWIG disabled at configure time'

error, like 'swig-py' and 'swig-rb' already do.

* build/generator/swig/header_wrappers.py

(write_makefile_rules): Make 'autogen-swig-%s' depend on '.swig_checked'.

Add comment with Arfrever's explanation as to why that is only necessary

for the swig-pl bindings, but not for swig-py and swig-rb.

Apply ASF license headers to a number of files included under that license

but lacking said header.

Patch by: Niall Pemberton <niallp{_AT_}apache.org>

  1. … 175 more files in changeset.
Follow-up to r38287:

* build/generator/swig/header_wrappers.py

(Generator._write_nodefault_calls): open(file, 'w') also truncates,

no need for 'w+'.

Found by: arfrever

Make our swig proxy wrapper generator write to intermediate temporary

files instead of writing to the result files directly.

Works around errors seen on some platforms, e.g. Suse Linux, such as:

/usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig/core.i:613: \

Error: Unable to find 'svn_auth_h.swg'

* build/generator/swig/header_wrappers.py

(Generator._write_nodefault_calls): Open a temporary file for other

methods to write to, and upon success copy the result to the actual

output file. We could use a more efficient solution (rename the

temporary file) if we raised the minimum Python version required to

build Subversion to 2.6. I'd say the only person who would not have

a problem with this is Arfrever :)

Patch by: OpenSUSE packagers

(but I've essentially rewritten it by adding proper tempfile handling)

Follow-up to r35314, fix the SWIG bindings to no longer wrapper

svn_auth_gnome_keyring_unlock_prompt_func_t.

* build/generator/swig/header_wrappers.py

(_ignores): Ignore 'svn_auth_gnome_keyring_unlock_prompt_func_t'.

(write_makefile_rules): Updated ignore logic to apply to callbacks.

Python 3 compatibility:

Use list comprehensions or list(map()) instead of map().

* build/generator/gen_base.py:

* build/generator/gen_make.py:

* build/generator/gen_vcnet_vcproj.py:

* build/generator/gen_win.py:

* build/generator/swig/header_wrappers.py:

* build/run_tests.py:

* subversion/tests/cmdline/changelist_tests.py:

* subversion/tests/cmdline/checkout_tests.py:

* subversion/tests/cmdline/getopt_tests.py:

* subversion/tests/cmdline/merge_tests.py:

* subversion/tests/cmdline/svnadmin_tests.py:

* subversion/tests/cmdline/svntest/actions.py:

* subversion/tests/cmdline/svntest/main.py:

* subversion/tests/cmdline/svntest/verify.py:

* subversion/tests/cmdline/tree_conflict_tests.py:

* tools/bdb/skel.py:

* tools/dev/iz/find-fix.py:

* tools/dev/svn-merge-revs.py:

* tools/dist/write-announcement.py:

* tools/hook-scripts/mailer/mailer.py:

* win-tests.py: Use list comprehensions or list(map()) instead of map().

  1. … 20 more files in changeset.
Python 3 compatibility:

Use str.replace() instead of string.replace().

* build/generator/gen_base.py:

* build/generator/gen_make.py:

* build/generator/gen_msvc_dsp.py:

* build/generator/gen_vcnet_vcproj.py:

* build/generator/gen_win.py:

* build/generator/swig/header_wrappers.py:

* build/strip-po-charset.py: Use str.replace() instead of string.replace().

  1. … 6 more files in changeset.
Python 3 compatibility:

Use str.join() instead of string.join().

* build/generator/gen_base.py:

* build/generator/gen_make.py:

* build/generator/gen_vcnet_vcproj.py:

* build/generator/gen_win.py:

* build/generator/swig/header_wrappers.py:

* subversion/libsvn_subr/genctype.py:

* subversion/tests/cmdline/commit_tests.py:

* tools/dev/iz/find-fix.py:

* tools/examples/svnshell.py:

* tools/hook-scripts/mailer/mailer.py:

* tools/hook-scripts/mailer/tests/mailer-t1.sh: Use str.join() instead of

string.join().

  1. … 10 more files in changeset.
Python 3 compatibility:

Use str.split() instead of string.split().

* build/generator/ezt.py:

* build/generator/gen_base.py:

* build/generator/gen_win.py:

* build/generator/swig/header_wrappers.py:

* build/generator/util/executable.py:

* tools/dev/iz/find-fix.py:

* tools/examples/svnshell.py:

* tools/hook-scripts/mailer/mailer.py:

* win-tests.py: Use str.split() instead of string.split().

  1. … 8 more files in changeset.
Python 3 compatibility:

Update calls to print() in 'build' directory, 'gen-make.py' and 'win-tests.py'.

* build/generator/extractor.py:

* build/generator/gen_win.py:

* build/generator/swig/checkout_swig_header.py:

* build/generator/swig/external_runtime.py:

* build/generator/swig/header_wrappers.py:

* build/get-py-info.py:

* build/getversion.py:

* build/run_tests.py:

* build/strip-po-charset.py:

* build/win32/make_dist.py:

* gen-make.py:

* win-tests.py: Call print() or file.write().

  1. … 11 more files in changeset.
Wrap or rename functions and vtable entries named 'open', to prevent

macro expansion with new versions of glibc. See Joe Orton's mail

about this: http://svn.haxx.se/dev/archive-2007-09/0343.shtml.

Patch by: joe

me

* subversion/libsvn_ra/ra_loader.h

(svn_ra__vtable_t.open_session): Was 'open'. All callers changed.

* subversion/libsvn_fs/fs-loader.h

(fs_library_vtable_t.open_fs, fs_library_vtable_t.open_fs_for_recovery):

Were 'open' and 'open_for_recovery', respectively. All callers changed.

* build/generator/swig/header_wrappers.py

(Generator._write_callbacks): Wrap generated callback function name

invocation in parentheses.

* everywhere else: Wrap 'open' calls in parentheses.

  1. … 18 more files in changeset.
Do not generate 'return' for callbacks return 'void'.

* build/generator/swig/header_wrappers.py

(_write_callback): Add 'return' only if return_type is not 'void'.

Approved by: dlr

Adjust SWIG bindings to automatically generate typemaps for batons.

The PY_AS_VOID typemap can now handle any type of opaque object,

including native Python objects and SWIG-wrapped C objects.

This commit removes the pool-based reference-tracking system that

was introduced in r19930. Instead, when you set an attribute on an

object, a copy of your Python object is stored internally.

* build/generator/swig/header_wrappers.py

(_write_baton_typemaps): New function.

(_re_batons): New regular expression.

(_write_swig_interface_file): Call _write_baton_typemaps

with list of batons.

(process_header_file): Calculate list of batons using _re_batons

and pass results to _write_swig_interface_file.

[ In subversion/bindings/swig ]

* client.i

(PY_AS_VOID): Remove apply statement. This typemap is now

applied automatically by header_wrappers.py.

* python/tests/client.py

(testBatonPlay): New test case.

(test_client_ctx_baton_lifetime): Tweak test to deal with new

baton lifetime semantics.

* python/libsvn_swig_py/swigutil_py.c

(addOwnedRef, removeOwnedRef): Remove constants.

(svn_swig_py_set_owned_ref): Remove function.

* python/libsvn_swig_py/swigutil_py.h

(svn_swig_py_set_owned_ref): Remove function.

* include/proxy.swg

(__getattr__, __setattr__): Adjust methods so that they save a

copy of Python objects.

* include/proxy_apr.swg

(destroy): Remove reference-tracking code.

(_add_owned_ref, _remove_owned_ref): Remove functions.

* include/svn_types.swg

(PY_AS_VOID): Extend typemap to support storing values

other than a PyObject. Track objects directly inside

the parent object instead of inside the pool.

  1. … 7 more files in changeset.
* build/generator/swig/header_wrappers.py

(_write_callback_typemaps): Add #ifdef SWIGPYTHON, so that the

CALLABLE_CALLBACK typemaps are only generated for the Python

bindings.

Make it possible to invoke callback functions directly in the

Python bindings. You can now treat any callback object as a

regular Python function, and invoke it directly.

[ In build/generator/swig ]

* header_wrappers.py

(_write_callback_typemaps): New function.

(_write_callbacks): Generate proxy methods / proxy objects

for callbacks.

[ In subversion/bindings/swig ]

* include/proxy.swg

(__getattr__): Only call the assert_valid function if it actually

exists on the returned value. If we're returning a function, for

example, it won't have a assert_valid member function.

(funcptr_proxy, funcptr_member_proxy): New macros for generating

proxy methods.

* include/svn_types.swg

(OUTPARAM): Add several types to the list of OUTPARAMS, so that

they will be wrapped correctly. Skip svn_txdelta_window_handler_t

for Python, because it is wrapped as a CALLABLE_CALLBACK.

(CALLABLE_CALLBACK): New typemap.

(PY_AS_VOID): Add 'out' typemap for PY_AS_VOID, so that it is

possible to look at batons in Python.

* python/tests/delta.py

(testTxWindowHandler): Actually test the generated

tx_invoke_window_handler function.

* python/tests/client.py

(testMethodCalls): Test direct method calls to callbacks.

* python/tests/ra.py

(test_commit2, test_commit, test_update): Invoke methods directly,

instead of via the generated invoke function. Test that return

values are not None.

  1. … 5 more files in changeset.
Update header_wrappers.py to be more tolerant of spacing differences in

include files, and to handle return values other than svn_error_t *.

This improvement allows us to wrap more of the callback functions

declared in the Subversion include files.

* build/generator/swig/header_wrappers.py

(_re_struct_callbacks, _re_typed_callbacks): Update to be more tolerant of

spacing differences, and to handle return values other than svn_error_t *.

(_write_callbacks): Ditto. Also delegate writing of callbacks to

_write_callback.

(_write_callback): New function.

Update SWIG bindings to automatically generate wrapper functions

for any callback function which is declared using a typedef in

a public header file.

Branch: trunk

Release: 1.5.x

* build/generator/swig/header_wrappers.py

(_write_callbacks): Output wrapper functions for callbacks

declared as a typedef.

(_re_struct_callbacks): Renamed from _re_callbacks.

(_re_typed_callbacks): New regular expression for parsing callbacks

declared as a typedef.

(_write_swig_interface_file): Include callbacks declared using a

typedef in the list of callbacks.

* subversion/bindings/swig/python/tests/delta.py

New test. Tests whether the tx_invoke_window_handler function was

generated.

* subversion/bindings/swig/python/tests/run_all.py

(suite): Add delta test to list of tests.

  1. … 2 more files in changeset.
Remove the 'auto dependency %include' feature from the Python SWIG bindings.

I do not know why it was added - it seems unnecessary, and was causing us

to unintentionally wrap more than we intended to wrap.

* build/generator/swig/header_wrappers.py (_write_includes):

Stop generating '%include *_h.swg' lines in generated *_h.swg files.

Additionally, lose the '%import apr.swg' and '%import proxy.swg' - there

is no point doing this in generated files when it these can be trivially

included globally.

* subversion/bindings/swig/svn_client.i: Remove kludge that is no longer

necessary, now that the above is done.

* subversion/bindings/swig/include/svn_global.swg:

Add %include of proxy.swg (apr.swg is already %included).

  1. … 2 more files in changeset.
Fix usage for header_wrappers.py.

Patch by: Bhuvaneswaran Arumugam <bhuvan@collab.net>

* build/generator/swig/header_wrappers.py

(__main__): include basename of the script in Usage statement.

Refactor gen_make.py, moving code for writing SWIG Makefile rules into

write_makefile_rules functions in the SWIG helper classes.

* build/generator/gen_make.py

(Generator.write): Move code for writing SWIG Makefile rules into

write_makefile_rules functions in the SWIG helper classes. Remove

swig-headers target, and instead bind the various dependencies directly

to the autogen-swig-%s targets.

* build/generator/swig/header_wrappers.py

(Generator.write_makefile_rules): New function. Writes the makefile rules

for generating SWIG wrappers for Subversion header files.

* build/generator/swig/external_runtime.py

(Generator.write_makefile_rules): New function. Writes the makefile rules

for generating external runtimes.

(Generator.write): Remove identical duplicated copy of function.

(Generator._output_file): New function. Returns the output filename of the

runtime for the given language.

  1. … 2 more files in changeset.
* build/generator/swig/header_wrappers.py

(Generator._ignores): Fix typo in comment.

Fix perl bindings digest-related function segfault, and actually

populate digest when requested.

* build/generator/swig/header_wrappers.py

Don't ignore svn_md5.h.

* swig/core.i

Include svn_md5.

* swig/include/svn_types.swg

Varioues changes to typemaps for char digest[] in different uses.

* swig/perl/libsvn_swig_perl/swigutil_pl.[ch]

New.

* swig/perl/native/Core.pm

(SVN::MD5): New overloaded class.

* swig/perl/native/Delta.pm

(apply): Revert to use coderef-goto.

* swig/perl/native/t/5delta.t

All tests pass.

  1. … 7 more files in changeset.
Upgrade Python bindings to automatically create proxy objects for unions.

Change svn_opt.h to use explicitly declared unions instead of anonymous

unions, so that our SWIG bindings can wrap these unions correctly.

Patch by: David James <james82@gmail.com>

* subversion/include/svn_opt.h

(svn_opt_revision_value): New.

(svn_opt_revision_t): Use svn_opt_revision_value instead of anonymous struct.

* build/generator/swig/header_wrappers.py

(Generator._re_structs, Generator._re_callbacks): Adjust regexp to

accept unions, and types without the _t suffix.

* subversion/python/tests/pool.py

(PoolTestCase.test_integer_struct_members): Test svn_opt_revision_value.

  1. … 2 more files in changeset.
Build generator cleanup. No change to output.

* build.conf (include-dirs, swig-include-dirs): Delete.

* build/generator/gen_base.py (GeneratorBase.__init__):

Do not read 'include-dirs', 'swig-include-dirs'.

* build/generator/swig/__init__.py: Use 'import ... as ...' shorthand.

Import _collect_paths.

(Generator.__init__): Read 'includes', not 'include-dirs'.

* build/generator/swig/header_wrappers.py

(Generator.__init__): Use self.includes, not self.include_dirs.

  1. … 3 more files in changeset.
Merge python-bindings-improvements to trunk, by comparing trunkURL with

branchURL.

Major changes:

* Always build SWIG headers in the build dir, unless we are still using

pristine SWIG headers from an official Subversion release (r15865).

* Enable SWIG bindings, even if we compile --without-swig. In release builds,

we can build the bindings without SWIG (r15857).

* Refactor SWIG generator to use a modular architecture, separate from the

Unix / Windows generators (r15855).

Minor changes:

* See r15879, r15870, r15868, r15867, r15857, and r15856.

Approved by: jerenkrantz

  1. … 17 more files in changeset.