|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 #!/usr/bin/env python |
|
17 ## |
|
18 # @author Teemu Rytkonen |
|
19 |
|
20 from optparse import OptionParser |
|
21 from cone.action import configroot2flat |
|
22 |
|
23 def get_parser(): |
|
24 parser = OptionParser() |
|
25 parser.add_option("-c", "--configuration", |
|
26 dest="configs", |
|
27 action="append", |
|
28 help="Defines the name of the configuration for the action, can be "\ |
|
29 "specified multiple times to include multiple configurations.", |
|
30 metavar="CONFIG", |
|
31 default=[]) |
|
32 |
|
33 parser.add_option("--config-wildcard", |
|
34 action="append", |
|
35 dest="config_wildcards", |
|
36 help="Wildcard pattern for including configurations, e.g. "\ |
|
37 "product_langpack_*_root.confml", |
|
38 metavar="WILDCARD", |
|
39 default=[]) |
|
40 |
|
41 parser.add_option("--config-regex", |
|
42 action="append", |
|
43 dest="config_regexes", |
|
44 help="Regular expression for including configurations, e.g. "\ |
|
45 "product_langpack_\\d{2}_root.confml", |
|
46 metavar="REGEX", |
|
47 default=[]) |
|
48 |
|
49 parser.add_option("-p", "--project",\ |
|
50 dest="project",\ |
|
51 help="defines the location of current project. Default is the current working directory.",\ |
|
52 default=".",\ |
|
53 metavar="STORAGE") |
|
54 return parser |
|
55 |
|
56 def main(): |
|
57 """ |
|
58 Configuration root flattener. |
|
59 """ |
|
60 parser = get_parser() |
|
61 options, _ = parser.parse_args() |
|
62 |
|
63 action = configroot2flat.ConeConfigroot2FlatAction( |
|
64 project = options.project, |
|
65 configs = options.configs, |
|
66 config_wildcards = options.config_wildcards, |
|
67 config_regexes = options.config_regexes) |
|
68 |
|
69 try: |
|
70 status = action.run() |
|
71 if status: |
|
72 action.save() |
|
73 action.close() |
|
74 except configroot2flat.Configroot2FlatFailed, e: |
|
75 parser.error(str(e)) |
|
76 |
|
77 if __name__ == "__main__": |
|
78 main() |