Пример #1
0
        def diryield(path):
            u"""Generate relevant files in directory path

            Returns (path, num) where num == 0 means path should be
            generated normally, num == 1 means the path is a directory
            and should be included iff something inside is included.

            """
            # Only called by Iterate. Internal.
            # todo: get around circular dependency issue by importing here
            from duplicity import robust
            for filename in robust.listpath(path):
                new_path = robust.check_common_error(error_handler,
                                                     Path.append,
                                                     (path, filename))
                if new_path:
                    s = self.Select(new_path)
                    if (new_path.type in [u"reg", u"dir"]
                        and not os.access(new_path.name, os.R_OK)) \
                            and (s == 1 or s == 2):
                        # Path is a file or folder that cannot be read, but
                        # should be included or scanned.
                        log.Warn(
                            _(u"Error accessing possibly locked file %s") %
                            new_path.uc_name, log.WarningCode.cannot_read,
                            util.escape(new_path.name))
                        if diffdir.stats:
                            diffdir.stats.Errors += 1
                    elif s == 1:
                        # Should be included
                        yield (new_path, 0)
                    elif s == 2 and new_path.isdir():
                        # Is a directory that should be scanned
                        yield (new_path, 1)
Пример #2
0
        def diryield(path):
            """Generate relevant files in directory path

            Returns (path, num) where num == 0 means path should be
            generated normally, num == 1 means the path is a directory
            and should be included iff something inside is included.

            """
            # todo: get around circular dependency issue by importing here
            from duplicity import robust  #@Reimport
            for filename in robust.listpath(path):
                new_path = robust.check_common_error(error_handler,
                                                     Path.append,
                                                     (path, filename))
                # make sure file is read accessible
                if (new_path and new_path.type in ["reg", "dir"]
                        and not os.access(new_path.name, os.R_OK)):
                    log.Warn(
                        _("Error accessing possibly locked file %s") %
                        util.ufn(new_path.name), log.WarningCode.cannot_read,
                        util.escape(new_path.name))
                    if diffdir.stats:
                        diffdir.stats.Errors += 1
                    new_path = None
                elif new_path:
                    s = self.Select(new_path)
                    if s == 1:
                        yield (new_path, 0)
                    elif s == 2 and new_path.isdir():
                        yield (new_path, 1)
Пример #3
0
        def diryield(path):
            """Generate relevant files in directory path

            Returns (path, num) where num == 0 means path should be
            generated normally, num == 1 means the path is a directory
            and should be included iff something inside is included.

            """
            # todo: get around circular dependency issue by importing here
            from duplicity import robust #@Reimport
            for filename in robust.listpath(path):
                new_path = robust.check_common_error(
                    error_handler, Path.append, (path, filename))
                # make sure file is read accessible
                if (new_path and new_path.type in ["reg", "dir"]
                    and not os.access(new_path.name, os.R_OK)):
                    log.Warn(_("Error accessing possibly locked file %s") % util.ufn(new_path.name),
                             log.WarningCode.cannot_read,
                             util.escape(new_path.name))
                    if diffdir.stats:
                        diffdir.stats.Errors +=1
                    new_path = None
                elif new_path:
                    s = self.Select(new_path)
                    if s == 1:
                        yield (new_path, 0)
                    elif s == 2 and new_path.isdir():
                        yield (new_path, 1)
Пример #4
0
        def diryield(path):
            u"""Generate relevant files in directory path

            Returns (path, num) where num == 0 means path should be
            generated normally, num == 1 means the path is a directory
            and should be included iff something inside is included.

            """
            # Only called by Iterate. Internal.
            # todo: get around circular dependency issue by importing here
            from duplicity import robust  # @Reimport
            for filename in robust.listpath(path):
                new_path = robust.check_common_error(
                    error_handler, Path.append, (path, filename))
                if new_path:
                    s = self.Select(new_path)
                    if (new_path.type in [u"reg", u"dir"]
                        and not os.access(new_path.name, os.R_OK)) \
                            and (s == 1 or s == 2):
                        # Path is a file or folder that cannot be read, but
                        # should be included or scanned.
                        log.Warn(_(u"Error accessing possibly locked file %s") %
                                 new_path.uc_name,
                                 log.WarningCode.cannot_read,
                                 util.escape(new_path.name))
                        if diffdir.stats:
                            diffdir.stats.Errors += 1
                    elif s == 1:
                        # Should be included
                        yield (new_path, 0)
                    elif s == 2 and new_path.isdir():
                        # Is a directory that should be scanned
                        yield (new_path, 1)