~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to utilities/migrater/make_control_file.py

  • Committer: Karl Fogel
  • Date: 2009-09-17 17:29:33 UTC
  • mto: This revision was merged to the branch mainline in revision 9497.
  • Revision ID: karl.fogel@canonical.com-20090917172933-xnd2vkd9is6y9te8
Add utilities/formatdoctest.py and utilities/migrater/, both brought
over from the old lp-dev-utils.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python2.5
 
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())