颠覆 python 绑定文档? [英] subversion python bindings documentation?
问题描述
在哪里可以找到使用 subversion python 绑定的好的介绍?
Where can I find a good introduction to using the subversion python bindings?
我发现 svnbook 中的一个部分谈论它;以及一些 1.3 中的基本示例.
I found one section in the svnbook that talks about it; and some basic examples from 1.3.
有没有更彻底和最新的内容?
Is there something a bit more thorough and up-to-date?
推荐答案
只是想在这里添加一点说明.
Just wanted to add a little clarification here.
感谢以上两个答案(@BenjaminWohlwend 和 @Logan),我意识到 Subversion 有不止一套 Python 绑定/接口;我在我的 Ubuntu 11.04 机器上做了这个:
Thanks to the above two answers (@BenjaminWohlwend and @Logan), I became aware there are more than one set of Python bindings/interfaces for Subversion; I did this on my Ubuntu 11.04 box:
$ apt-cache search '[Ss]vn|[Ss]ubversion' | grep -i python
python-svn - A(nother) Python interface to Subversion
python-svn-dbg - A(nother) Python interface to Subversion (debug extension)
python-subversion - Python bindings for Subversion
python-subversion-dbg - Python bindings for Subversion (debug extension)
python-opster - a python command line parsing speedster
python-py - Advanced Python testing tool and networking lib
python-rope - Python refactoring library
python-subvertpy - Alternative Python bindings for Subversion
您可以查看 Debian 软件包文件列表,以确定它们引用了哪些库;所以我们有:
One can look at the Debian package filelist, to determine which libraries these refer to; so we have:
python-subversion
- 或 SWIG 绑定(或libsvn
、libsvn_swig_py
)文件列表- 示例:http://svn.apache.org/repos/asf/subversion/trunk/tools/examples/ , http://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/swig/python/tests/
import svn.core, svn.client
;from svn import fs, core, repos
python-subversion
- or SWIG bindings (orlibsvn
,libsvn_swig_py
) filelist- Examples: http://svn.apache.org/repos/asf/subversion/trunk/tools/examples/ , http://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/swig/python/tests/
import svn.core, svn.client
;from svn import fs, core, repos
- 示例:http://sourcecodebrowser.com/pysvn/7404d704d70404d704d704d7fb2488815fb2488815.html , http://pysvn.tigris.org/docs/pysvn_prog_guide.html
导入pysvn
- 示例:http://sourcecodebrowser.com/subvertpy/0.727b80808000000000000000000000000.html
from subvertpy import delta, repos
,from subvertpy.ra import RemoteAccess, Auth
...而且我还在存储库中找到了另一个:
... and I also found another in the repository:
ctypes-python
- 或csvn
源- 示例:http://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/ctypes-python/examples/
import csvn.core
,from csvn.repos import *
ctypes-python
- orcsvn
source- Examples: http://svn.apache.org/repos/asf/subversion/trunk/subversion/bindings/ctypes-python/examples/
import csvn.core
,from csvn.repos import *
链接http://svn.apache.org/repos/asf/subversion(我从 @BenjaminWohlwend 获得)显然是 Apache 软件基金会(asf?)Subversion 源代码的 Subversion 存储库本身.
The link http://svn.apache.org/repos/asf/subversion (which I got from @BenjaminWohlwend) is apparently the Apache Software Foundation (asf?) Subversion repository for Subversion source code itself.
OP 对文档的追求似乎与
python-subversion
(或 SWIG 绑定(或libsvn
)有关;其从源代码构建的指令在 @Logan 的帖子.我从 svn.developer:使用 OP 中已经提到的 API,除了 bindings/swig/python/README;它解释了 SWIG 如何生成来自 C 的 Python 接口:The OP's quest for documentation seems related to
python-subversion
(or SWIG bindings (orlibsvn
); whose build-from-source instructions are in @Logan's post. I couldn't find much better documentation source from the svn.developer: Using the APIs already referred in the OP, except for the bindings/swig/python/README; it explains how SWIG generates Python interfaces from C:翻译参数列表
SWIG 绑定的参数减少法则类似于
这个:The argument-reductions laws of the SWIG bindings something go like
this:- The module prefix can be omitted. o: void *some_C_function = svn_client_foo; becomes: import svn.client func = svn.client.foo
[...]
然后,可以查看,例如,svn/core.py,并找到像
svn_mergeinfo_merge
这样的函数(和显式定义的符号");注意到core.py
导入libsvn.core
- 其中libsvn
可能指的是共享对象 (.so
)从 C 文件构建的文件 libsvn_swig_py/swigutil_py.c.Then, one could look in, say, svn/core.py, and find functions (and "Symbols defined explicitly") like
svn_mergeinfo_merge
; noting thatcore.py
importslibsvn.core
- wherelibsvn
probably refers to the shared object (.so
) files built from the C file libsvn_swig_py/swigutil_py.c.然后,我们可以查找
svn_mergeinfo_merge
,并找到类似SVNSearch: Subversion (commit 23570 05.03.2007),引用该函数,以及一个svn_mergeinfo.h
;进一步查找该文件,我们在 ASF 存储库中找到了它:svn_mergeinfo.h,其中确实包含:Then, we can look up
svn_mergeinfo_merge
, and find a commit message like SVNSearch: Subversion (commit 23570 05.03.2007), which refers to that function, and asvn_mergeinfo.h
; looking up that file further, we find it in the ASF repository: svn_mergeinfo.h, which indeed contains:/** Like svn_mergeinfo_merge2, but uses only one pool. * * @deprecated Provided for backward compatibility with the 1.5 API. */ SVN_DEPRECATED svn_error_t * svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo, svn_mergeinfo_t changes, apr_pool_t *pool);
在那里看到
DEPRECATED
,在这里参考 svn 提交:r1175903(2011 年 9 月 26 日星期一):Seeing
DEPRECATED
there, it's probably good here to refer to svn commit: r1175903 (Mon Sep 26 2011):subversion/libsvn_subr/mergeinfo.c
subversion/libsvn_subr/mergeinfo.c
(svn_mergeinfo_merge2):新的.
(svn_mergeinfo_merge2): New.
(svn_mergeinfo_merge):移至 deprecated.c.
(svn_mergeinfo_merge): Move to deprecated.c.
(svn_mergeinfo_catalog_merge):使用新的 API.
(svn_mergeinfo_catalog_merge): Use the new API.
也就是说 - 该特定功能已在 2011 年弃用 - 所以希望 Python SVN 绑定和 SVN 安装应该匹配...
That is - that particular function has been deprecated in 2011 - so hopefully, one's Python SVN bindings and SVN installation should be matching...
这篇关于颠覆 python 绑定文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!