/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: 2016-04-10 20:29:46 UTC
  • Revision ID: tim@ed.am-20160410202946-9eoh5i3et9443aq6
fixed greps in tools/dev to detect home-dir lines in stdhomerc

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:
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
 
                if rel_file in { '.bzr', '.bzrignore', '.stdhome', '.stdhomerc' }:
 
111
                if rel_file in [ '.bzr', '.bzrignore', '.stdhome', '.stdhomerc' ]:
108
112
                        return list()
109
113
 
110
114
                full_file = os.path.join( full_dir, rel_file )
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