~duplicity-team/duplicity/0.7-series

« back to all changes in this revision

Viewing changes to duplicity/backends/rsyncbackend.py

  • Committer: Kenneth Loafman
  • Date: 2015-01-01 13:07:31 UTC
  • Revision ID: kenneth@loafman.com-20150101130731-6i3lb8r9rz4qpz2y
* Misc fixes for the following PEP8 issues:
   - E211, E221, E222, E225, E226, E228
   - see http://pep8.readthedocs.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
        self.subprocess_popen(commandline)
113
113
 
114
114
    def _get(self, remote_filename, local_path):
115
 
        remote_path = os.path.join (self.url_string, remote_filename)
 
115
        remote_path = os.path.join(self.url_string, remote_filename)
116
116
        commandline = "%s %s %s" % (self.cmd, remote_path, local_path.name)
117
117
        self.subprocess_popen(commandline)
118
118
 
119
119
    def _list(self):
120
 
        def split (str):
121
 
            line = str.split ()
122
 
            if len (line) > 4 and line[4] != '.':
 
120
        def split(str):
 
121
            line = str.split()
 
122
            if len(line) > 4 and line[4] != '.':
123
123
                return line[4]
124
124
            else:
125
125
                return None
126
126
        commandline = "%s %s" % (self.cmd, self.url_string)
127
127
        result, stdout, stderr = self.subprocess_popen(commandline)
128
 
        return [x for x in map (split, stdout.split('\n')) if x]
 
128
        return [x for x in map(split, stdout.split('\n')) if x]
129
129
 
130
130
    def _delete_list(self, filename_list):
131
131
        delete_list = filename_list
132
132
        dont_delete_list = []
133
 
        for file in self._list ():
 
133
        for file in self._list():
134
134
            if file in delete_list:
135
 
                delete_list.remove (file)
 
135
                delete_list.remove(file)
136
136
            else:
137
 
                dont_delete_list.append (file)
 
137
                dont_delete_list.append(file)
138
138
 
139
139
        dir = tempfile.mkdtemp()
140
140
        exclude, exclude_name = tempdir.default().mkstemp_file()
141
141
        to_delete = [exclude_name]
142
142
        for file in dont_delete_list:
143
 
            path = os.path.join (dir, file)
144
 
            to_delete.append (path)
145
 
            f = open (path, 'w')
 
143
            path = os.path.join(dir, file)
 
144
            to_delete.append(path)
 
145
            f = open(path, 'w')
146
146
            print >> exclude, file
147
147
            f.close()
148
148
        exclude.close()
151
151
        self.subprocess_popen(commandline)
152
152
        for file in to_delete:
153
153
            util.ignore_missing(os.unlink, file)
154
 
        os.rmdir (dir)
 
154
        os.rmdir(dir)
155
155
 
156
156
duplicity.backend.register_backend("rsync", RsyncBackend)
157
157
duplicity.backend.uses_netloc.extend([ 'rsync' ])