Guido van Rossum | 30e53c0 | 1997-08-14 20:14:54 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | |
| 3 | """Create a list of files that are mentioned in CVS directories.""" |
| 4 | |
| 5 | import os |
| 6 | import sys |
| 7 | import string |
| 8 | |
| 9 | def main(): |
| 10 | args = sys.argv[1:] |
| 11 | if args: |
| 12 | for arg in args: |
| 13 | process(arg) |
| 14 | else: |
| 15 | process(".") |
| 16 | |
| 17 | def process(dir): |
| 18 | cvsdir = 0 |
| 19 | subdirs = [] |
| 20 | files = [] |
| 21 | names = os.listdir(dir) |
| 22 | for name in names: |
| 23 | fullname = os.path.join(dir, name) |
| 24 | if name == "CVS": |
| 25 | cvsdir = fullname |
| 26 | else: |
| 27 | if os.path.isdir(fullname): |
| 28 | subdirs.append(fullname) |
| 29 | else: |
| 30 | files.append(fullname) |
| 31 | if cvsdir: |
| 32 | entries = os.path.join(cvsdir, "Entries") |
| 33 | for e in open(entries).readlines(): |
| 34 | words = string.split(e, '/') |
| 35 | if words[0] == '' and words[1:]: |
| 36 | name = words[1] |
| 37 | print os.path.join(dir, name) |
| 38 | for sub in subdirs: |
| 39 | process(sub) |
| 40 | |
| 41 | main() |
| 42 | |