~ubuntu-branches/ubuntu/lucid/duplicity/lucid-proposed

« back to all changes in this revision

Viewing changes to src/robust.py

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Moog
  • Date: 2009-04-29 14:02:39 UTC
  • mfrom: (1.1.10 upstream) (5.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090429140239-kegsd7bugcllpnce
Tags: 0.5.16-1ubuntu1
* Merge from debian unstable, remaining changes: (LP: #369224)
  - debian/rules:
    + add --install-layout=deb to setup.py
    + s/site-packages/*-packages/
    + don't use package provided GnuPGInterface
      - debian uses it because of debian bug #509415, which is fixed in
        ubuntu. (See bug 333057 on LP)
  - debian/patches
    + add 01_use_python_gnupginterface.dpatch
      - use GnuPGInterface provided by python-gnupginterface
* Fixes at least:
  - use of ssh with given portnumber (LP: #259076)

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#
8
8
# Duplicity is free software; you can redistribute it and/or modify it
9
9
# under the terms of the GNU General Public License as published by the
10
 
# Free Software Foundation; either version 3 of the License, or (at your
 
10
# Free Software Foundation; either version 2 of the License, or (at your
11
11
# option) any later version.
12
12
#
13
13
# Duplicity is distributed in the hope that it will be useful, but
32
32
 
33
33
    """
34
34
    # todo: import here to avoid circular dependency issue
35
 
    import duplicity.path as path
 
35
    from duplicity import path
36
36
 
37
 
    try: return function(*args)
 
37
    try:
 
38
        return function(*args)
38
39
    #except (EnvironmentError, SkipFileException, DSRPPermError,
39
40
    #       RPathException, Rdiff.RdiffException,
40
41
    #       librsync.librsyncError, C.UnknownFileTypeError), exc:
41
42
    #   TracebackArchive.add()
42
 
    except (EnvironmentError, librsync.librsyncError, path.PathException), exc:
 
43
    except (IOError, EnvironmentError, librsync.librsyncError, path.PathException), exc:
43
44
        if (not isinstance(exc, EnvironmentError) or
44
45
            ((exc[0] in errno.errorcode)
45
46
             and errno.errorcode[exc[0]] in
47
48
              'ENOTDIR', 'ENAMETOOLONG', 'EINTR', 'ENOTEMPTY',
48
49
              'EIO', 'ETXTBSY', 'ESRCH', 'EINVAL'])):
49
50
            #Log.exception()
50
 
            if error_handler: return error_handler(exc, *args)
 
51
            if error_handler:
 
52
                return error_handler(exc, *args)
51
53
        else:
52
54
            #Log.exception(1, 2)
53
55
            raise
55
57
def listpath(path):
56
58
    """Like path.listdir() but return [] if error, and sort results"""
57
59
    def error_handler(exc):
58
 
        log.Log(_("Error listing directory %s") % path.name, 2)
 
60
        log.Warn(_("Error listing directory %s") % path.name)
59
61
        return []
60
62
    dir_listing = check_common_error(error_handler, path.listdir)
61
63
    dir_listing.sort()
62
64
    return dir_listing
63
65
 
64
 
import duplicity.librsync as librsync
65
 
import duplicity.log as log
 
66
from duplicity import librsync
 
67
from duplicity import log
66
68