recursively descend the directory tree rooted at top. Return all of the directories as a list. This should work on python2.2
(self, top)
| 403 | return pattern |
| 404 | |
| 405 | def _walktree_compat(self, top): |
| 406 | ''' |
| 407 | recursively descend the directory tree rooted at top. |
| 408 | Return all of the directories as a list. This should work |
| 409 | on python2.2 |
| 410 | ''' |
| 411 | |
| 412 | dirlist = [] |
| 413 | templist = [] |
| 414 | try: |
| 415 | templist = os.listdir(top) |
| 416 | except OSError, err: |
| 417 | import errno |
| 418 | if err.errno == errno.ENOENT: |
| 419 | return [] |
| 420 | |
| 421 | for f in templist: |
| 422 | pathname = os.path.join(top, f) |
| 423 | try: |
| 424 | mode = os.stat(pathname)[ST_MODE] |
| 425 | except OSError, err: |
| 426 | import errno |
| 427 | if err.errno == errno.ENOENT: |
| 428 | continue |
| 429 | if S_ISDIR(mode): |
| 430 | # It's a directory, recurse into it |
| 431 | dirlist.append(pathname) |
| 432 | dirlist.extend(self._walktree_compat(pathname)) |
| 433 | return dirlist |
| 434 | |
| 435 | |
| 436 | def __setitem__(self, key, value): |