~launchpad-pqm/launchpad/devel

10637.3.1 by Guilherme Salgado
Use the default python version instead of a hard-coded version
1
#!/usr/bin/python
9492.1.1 by Karl Fogel
Add utilities/formatdoctest.py and utilities/migrater/, both brought
2
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
6
"""Create a control file of file that should be migrated."""
7
8
import sys
9
10
from find import find_files
11
from migrater import OLD_TOP
12
13
14
TLA_COMMON_MAP = dict(
15
    ans=[],
16
    app=[],
17
    blu=['blueprint', 'specification', 'sprint', 'specgraph'],
18
    bug=[],
19
    cod=[],
20
    reg=[],
21
    sha=[],
22
    soy=[],
23
    svc=[],
24
    tes=[],
25
    tra=[],
26
    )
27
28
29
def main(argv=None):
30
    """Run the command line operations."""
31
    skip_dir_pattern = r'^[.]|templates|icing'
32
    for file_path in find_files(OLD_TOP, skip_dir_pattern=skip_dir_pattern ):
33
        file_path = file_path.replace(OLD_TOP, '.')
34
        code = '   '
35
        for app_code in TLA_COMMON_MAP:
36
            for common_name in TLA_COMMON_MAP[app_code]:
37
                if common_name in file_path:
38
                    code = app_code
39
                    break
40
        print '%s %s' % (code, file_path)
41
42
43
if __name__ == '__main__':
44
    sys.exit(main())