|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 04-Feb-2021 | - |
| libsvn_swig_py/ | H | 04-Feb-2021 | - | 6,058 | 4,686 |
| svn/ | H | 04-Feb-2021 | - | 1,177 | 682 |
| tests/ | H | 04-Feb-2021 | - | 6,142 | 4,385 |
| README | H A D | 18-Mar-2013 | 2.5 KiB | 91 | 62 |
| __init__.py | H A D | 22-Feb-2010 | 1.1 KiB | 26 | 0 |
| client.py | H A D | 04-Feb-2021 | 213.7 KiB | 4,191 | 2,684 |
| core.c | H A D | 04-Feb-2021 | 1.3 MiB | 40,863 | 35,716 |
| core.py | H A D | 04-Feb-2021 | 404.4 KiB | 9,523 | 6,124 |
| delta.py | H A D | 04-Feb-2021 | 68.9 KiB | 1,681 | 1,033 |
| diff.py | H A D | 04-Feb-2021 | 67.8 KiB | 1,460 | 940 |
| fs.py | H A D | 04-Feb-2021 | 125.1 KiB | 3,105 | 1,915 |
| ra.py | H A D | 04-Feb-2021 | 123.4 KiB | 2,932 | 1,800 |
| repos.py | H A D | 04-Feb-2021 | 133.6 KiB | 2,772 | 1,769 |
| svn_client.c | H A D | 04-Feb-2021 | 1.3 MiB | 40,723 | 36,918 |
| svn_delta.c | H A D | 04-Feb-2021 | 393.3 KiB | 11,409 | 9,867 |
| svn_diff.c | H A D | 04-Feb-2021 | 421.8 KiB | 12,691 | 11,034 |
| svn_fs.c | H A D | 04-Feb-2021 | 565.3 KiB | 17,876 | 15,668 |
| svn_ra.c | H A D | 04-Feb-2021 | 716.4 KiB | 20,166 | 17,895 |
| svn_repos.c | H A D | 04-Feb-2021 | 814.3 KiB | 24,568 | 21,963 |
| svn_wc.c | H A D | 04-Feb-2021 | 1.5 MiB | 43,728 | 39,356 |
| wc.py | H A D | 04-Feb-2021 | 260.1 KiB | 5,225 | 3,372 |
README
1 -*- text -*-
2
3TRANSLATING PARAMETER LISTS
4
5 The argument-reductions laws of the SWIG bindings something go like
6 this:
7
8 - The module prefix can be omitted. o:
9
10 void *some_C_function = svn_client_foo;
11
12 becomes:
13
14 import svn.client
15 func = svn.client.foo
16
17 However, the following two alternatives also work:
18
19 # Fully-qualified C name
20 import svn.client
21 func = svn.client.svn_client_foo
22
23 # Star-import imports just svn_* names, not bare 'foo' names.
24 from svn.client import *
25 func = svn_client_foo
26
27 - Python functions don't return errors. They throw exceptions.
28 Which means that...
29
30 - ...Python functions will return the "other" stuff that the C
31 functions "return" instead. C functions which populate
32 pointers with new data (you know, values that are returned to
33 the caller, but not as "return values") will return those
34 values directly in Python. So:
35
36 object_t *returned_obj;
37 SVN_ERR(svn_client_foo(&returned_obj, blah));
38
39 becomes:
40
41 returned_obj = svn.client.foo(blah)
42
43 and:
44
45 err = svn_client_foo(&returned_obj, blah);
46 if (err && err->apr_err == SVN_ERR_...)
47 /* handle it */
48
49 becomes:
50
51 try:
52 returned_obj = svn.client.foo(blah)
53 except:
54 # handle it
55
56 - Callback function/baton pairs get reduced to just callback
57 functions, and the benefit you get from batons is gotten
58 instead through defining the callback function locally and
59 passing the 'baton' data in through Python default arguments. So:
60
61 struct baton_t { userdata1, ... };
62
63 svn_error_t *cb_func(cb_arg1, ..., void *baton)
64 {
65 baton_t *b = baton;
66 /* do stuff here with b->userdata1... etc. */
67 }
68
69 /* Now use it: */
70 {
71 baton_t *b = { whatever, ... };
72 error = svn_client_foo(cb_func, b);
73 }
74
75 becomes:
76
77 def cb_func(cb_arg1, ..., userdata1=whatever, ...):
78 # do stuff here with userdata1 etc.
79 svn.client.foo(cb_func)
80
81
82RUNNING THE TESTS
83
84 $ cd subversion/bindings/swig/python
85 $ python ./tests/run_all.py --help
86 $ python ./tests/run_all.py [TEST...]
87
88 where TEST can be the name of a test suite ('core', 'mergeinfo',
89 'client', etc.), or see '--help' for other options. The default is to
90 run the tests in all modules.
91