/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/walker/walker.py

  • Committer: Tim Marston
  • Date: 2014-07-17 18:17:18 UTC
  • Revision ID: tim@ed.am-20140717181718-gxi5lpi8qszsigxf
switch to using bzr+ssh, rather than sftp (to work around broken pimiko)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
 
22
22
import os
 
23
import stdhome.the as the
23
24
 
24
25
 
25
26
class Walker:
79
80
                        else:
80
81
                                self.type = '?'
81
82
                        if os.path.islink( self.file ):
82
 
                                self.link_type = type
 
83
                                self.link_type = self.type
83
84
                                self.type = 'l'
84
85
                        else:
85
86
                                self.link_type = False
98
99
 
99
100
 
100
101
        @staticmethod
101
 
        def generate_walk_list( full_dir, rel_file = '' ):
 
102
        def generate_walk_list( rel_file = '', full_dir = None ):
102
103
                """Returns a list of files and directories in full_dir, specified as relative
103
104
                files (relative to full_dir), breadth first.
104
105
                """
105
106
 
 
107
                # default place to walk
 
108
                if full_dir is None: full_dir = the.repo.full_dir
 
109
 
106
110
                # ignore some files
107
111
                if rel_file in { '.bzr', '.bzrignore', '.stdhome', '.stdhomerc' }:
108
112
                        return list()
118
122
                        ret = [ rel_file ] if rel_file != '' else []
119
123
                        for file in os.listdir( full_file ):
120
124
                                ret.extend( Walker.generate_walk_list(
121
 
                                        full_dir, os.path.join( rel_file, file ) ) )
 
125
                                        os.path.join( rel_file, file ), full_dir ) )
122
126
                        return sorted( ret )
123
127
 
124
128
                # other kinds are invalid