call site 1 for path.local.listdir
apigen/testing/test_apigen_example.py - line 399
398
399
400
401
402
403
404
405
406
407
408
409
410
   def test_build_pages_nav(self):
->     self.spb.build_pages(self.fs_root)
       self.linker.replace_dirpath(self.base, False)
       funcsource = self.base.join('source/pkg/func.py.html')
       assert funcsource.check(file=True)
       html = funcsource.read()
       print html
       run_string_sequence_test(html, [
           'href="../style.css"',
           '<a href="index.html">pkg</a>',
           '<a href="someclass.py.html">someclass.py</a>',
           '<a href="somesubclass.py.html">somesubclass.py</a>',
       ])
apigen/htmlgen.py - line 305
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
   def build_pages(self, base):
       for fspath in [base] + list(base.visit()):
           if fspath.ext in ['.pyc', '.pyo']:
               continue
           if self.capture:
               self.capture.err.writeorg('.')
           relfspath = fspath.relto(base)
           if relfspath.find('%s.' % (os.path.sep,)) > -1:
               # skip hidden dirs and files
               continue
           elif fspath.check(dir=True):
               if relfspath != '':
                   relfspath += os.path.sep
               reloutputpath = 'source%s%sindex.html' % (os.path.sep,
                                                         relfspath)
           else:
               reloutputpath = "source%s%s.html" % (os.path.sep, relfspath)
           reloutputpath = reloutputpath.replace(os.path.sep, '/')
           outputpath = self.base.join(reloutputpath)
           self.linker.set_link(str(fspath), reloutputpath)
->         self.build_page(fspath, outputpath, base)
apigen/htmlgen.py - line 311
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
   def build_page(self, fspath, outputpath, base):
       """ build syntax-colored source views """
       if fspath.check(ext='.py'):
           try:
->             tag, nav = self.build_python_page(fspath)
           except (KeyboardInterrupt, SystemError):
               raise
           except: # XXX strange stuff going wrong at times... need to fix
               raise
               exc, e, tb = py.std.sys.exc_info()
               print '%s - %s' % (exc, e)
               print
               print ''.join(py.std.traceback.format_tb(tb))
               print '-' * 79
               del tb
               tag, nav = self.build_nonpython_page(fspath)
       elif fspath.check(dir=True):
           tag, nav = self.build_dir_page(fspath)
       else:
           tag, nav = self.build_nonpython_page(fspath)
       title = 'sources for %s' % (fspath.basename,)
       rev = self.get_revision(fspath)
       if rev:
           title += ' [rev. %s]' % (rev,)
       reltargetpath = outputpath.relto(self.base).replace(os.path.sep,
                                                           '/')
       self.write_page(title, reltargetpath, tag, nav)
apigen/htmlgen.py - line 266
258
259
260
261
262
263
264
265
266
267
   def build_python_page(self, fspath):
       # XXX two reads of the same file here... not very bad (disk caches
       # and such) but also not very nice...
       enc = source_html.get_module_encoding(fspath.strpath)
       source = fspath.read()
       sep = get_linesep(source)
       colored = [enumerate_and_color(source.split(sep), 0, enc)]
       tag = H.PythonSource(colored)
->     nav = self.build_navigation(fspath)
       return tag, nav
apigen/htmlgen.py - line 245
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
   def build_navigation(self, fspath):
       nav = H.Navigation(class_='sidebar')
       relpath = fspath.relto(self.projroot)
       path = relpath.split(os.path.sep)
       indent = 0
       # build links to parents
       if relpath != '':
           for i in xrange(len(path)):
               dirpath = os.path.sep.join(path[:i])
               abspath = self.projroot.join(dirpath).strpath
               if i == 0:
                   text = self.projroot.basename
               else:
                   text = path[i-1]
               nav.append(H.NavigationItem(self.linker, abspath, text,
                                           indent, False))
               indent += 1
       # build siblings or children and self
       if fspath.check(dir=True):
           # we're a dir, build ourselves and our children
           dirpath = fspath
           nav.append(H.NavigationItem(self.linker, dirpath.strpath,
                                       dirpath.basename, indent, True))
           indent += 1
       elif fspath.strpath == self.projroot.strpath:
           dirpath = fspath
       else:
           # we're a file, build our parent's children only
           dirpath = fspath.dirpath()
->     diritems, fileitems = source_dirs_files(dirpath)
       for dir in diritems:
           nav.append(H.NavigationItem(self.linker, dir.strpath, dir.basename,
                                       indent, False))
       for file in fileitems:
           selected = (fspath.check(file=True) and
                       file.basename == fspath.basename)
           nav.append(H.NavigationItem(self.linker, file.strpath,
                                       file.basename, indent, selected))
       return nav
apigen/htmlgen.py - line 96
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
   def source_dirs_files(fspath):
       """ returns a tuple (dirs, files) for fspath
   
           dirs are all the subdirs, files are the files which are interesting
           in building source documentation for a Python code tree (basically all
           normal files excluding .pyc and .pyo ones)
   
           all files and dirs that have a name starting with . are considered
           hidden
       """
       dirs = []
       files = []
->     for child in fspath.listdir():
           if child.basename.startswith('.'):
               continue
           if child.check(dir=True):
               dirs.append(child)
           elif child.check(file=True):
               if child.ext in ['.pyc', '.pyo']:
                   continue
               files.append(child)
       return sorted(dirs), sorted(files)