[Dar-libdar_api] Problems with the Python bindings
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Martin B. <mar...@on...> - 2007-03-23 09:53:48
|
Hi,
I'm one of the developers of HUBackup [0] in Ubuntu. As the program is
written in Python, we now decided that it would be nice if we used the
DAR Python bindings [1].
However, there seem to be some problems with the bindings themselves. I
could fix some, but I'm now at a point where I don't really know where
the problem is exactly.
The problems I fixed were:
1. The bindings wouldn't compile in one step. Once invoking "make"
failed, doing it a second time worked. The fix was a small %import
statement in user_interaction.i
2. The bindings wouldn't work with the default Debian mode of 64. I
fixed that by changing the Makefiles and adjusting one or two *.i files.
The bindings now compile and load with every mode.
3. The bindings didn't work when specifying a user_interaction object.
As python does not work with something like that:
test.py:
*********************************
#!/usr/bin/env python
def fun_test(param1):
print param1
def fun_fail(param1):
if param1 == None:
fun_test = None
else:
fun_test(param1)
fun_fail("Bla")
*********************************
But that was also easily fixable.
I will attach a small patch that fixes these problems when the patch is
applied. I deleted the Perl and Ruby bindings stuff since it is not
really necessary.
Our code now successfully uses the List job and I can even see all the
files in an dar archive so that works correctly. However, I can not use
the Extract Job. When I set Verbose to "true" I get the message
"Extracting contents from the archive" but that is it. The dar archive
is small enough so that it shouldn't take long to extract something.
However, the "Extracting ..." is the last message that I get. (My
interaction stuff is ok since it works with the list job).
I suspect that there is a problem with the masks. I get a lot of
"swig/python detected a memory leak of type 'std::string *', no
destructor found." warnings which I think appear in mask. Also, I can't
use the list job with a specific mask to only show parts of the files in
the archive.
I currently use the following code snippet to access the extract object:
Excerpt from hurestore.py:
*********************************
from dar import job
class hurestore:
restore(self):
job_extract = job.Extract()
job_extract.interaction = gtk_interaction(self.window)
job_extract.root_path = self.path_to_which_restoring
job_extract.archive_path = self.path_where_archive_is
job_extract.archive_name = self.archive_name
job_extract.verbose = True
job_extract.selection = True
job_extract.run()
*********************************
This gives me the above behaviour.
This is all the information I think are interesting so far but if you
need more, just ask.
Thanks in advance,
Martin
[0] https://launchpad.net/hubackup
[1] http://darbinding.sourceforge.net
|