-rwxr-xr-x | scripts/builder/main.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/builder/main.py b/scripts/builder/main.py index ba0c72a..94f738f 100755 --- a/scripts/builder/main.py +++ b/scripts/builder/main.py | |||
@@ -1,49 +1,49 @@ | |||
1 | #!/usr/bin/python | 1 | #!/usr/bin/env python |
2 | # -*- coding: UTF-8 -*- | 2 | # -*- coding: UTF-8 -*- |
3 | 3 | ||
4 | import sys, os, json | 4 | import sys, os, json |
5 | import shutil | 5 | import shutil |
6 | import pprint | 6 | import pprint |
7 | import frontendBuilder | 7 | import frontendBuilder |
8 | import codecs | 8 | import codecs |
9 | import itertools | 9 | import itertools |
10 | 10 | ||
11 | from collections import deque | 11 | from collections import deque |
12 | from phpBuilder import PhpBuilder | 12 | from phpBuilder import PhpBuilder |
13 | from pythonBuilder import PythonBuilder | 13 | from pythonBuilder import PythonBuilder |
14 | 14 | ||
15 | pp = pprint.PrettyPrinter(indent=4, depth=4) | 15 | pp = pprint.PrettyPrinter(indent=4, depth=4) |
16 | 16 | ||
17 | #-------------------------------------------------------------------- | 17 | #-------------------------------------------------------------------- |
18 | 18 | ||
19 | def scriptDir (): | 19 | def scriptDir (): |
20 | return os.path.dirname(sys.argv[0]) | 20 | return os.path.dirname(sys.argv[0]) |
21 | 21 | ||
22 | def projectBaseDir (): | 22 | def projectBaseDir (): |
23 | return os.path.abspath(scriptDir() + '/../..') | 23 | return os.path.abspath(scriptDir() + '/../..') |
24 | 24 | ||
25 | def projectTargetDir(): | 25 | def projectTargetDir(): |
26 | return projectBaseDir() + '/target/' | 26 | return projectBaseDir() + '/target/' |
27 | 27 | ||
28 | #-------------------------------------------------------------------- | 28 | #-------------------------------------------------------------------- |
29 | 29 | ||
30 | def createFolder (path): | 30 | def createFolder (path): |
31 | if not os.path.exists(path): | 31 | if not os.path.exists(path): |
32 | os.makedirs(path) | 32 | os.makedirs(path) |
33 | 33 | ||
34 | #-------------------------------------------------------------------- | 34 | #-------------------------------------------------------------------- |
35 | 35 | ||
36 | def loadSettings (component, module): | 36 | def loadSettings (component, module): |
37 | print "MODULE: " + module | 37 | print "MODULE: " + module |
38 | 38 | ||
39 | if '.' in module: | 39 | if '.' in module: |
40 | moduleComponents = module.split('.') | 40 | moduleComponents = module.split('.') |
41 | module = moduleComponents[0] | 41 | module = moduleComponents[0] |
42 | submodule = moduleComponents[1] | 42 | submodule = moduleComponents[1] |
43 | else: | 43 | else: |
44 | submodule = module | 44 | submodule = module |
45 | 45 | ||
46 | settings = codecs.open(projectBaseDir() + '/' + component + '/' + module + '/properties/' + submodule + '.properties.json', 'r', 'utf-8') | 46 | settings = codecs.open(projectBaseDir() + '/' + component + '/' + module + '/properties/' + submodule + '.properties.json', 'r', 'utf-8') |
47 | result = json.load(settings) | 47 | result = json.load(settings) |
48 | settings.close | 48 | settings.close |
49 | 49 | ||
@@ -118,49 +118,49 @@ def usage (message): | |||
118 | 118 | ||
119 | #-------------------------------------------------------------------- | 119 | #-------------------------------------------------------------------- |
120 | 120 | ||
121 | def main (): | 121 | def main (): |
122 | settings = {} | 122 | settings = {} |
123 | parameters = list(itertools.islice(sys.argv, 1, None)) | 123 | parameters = list(itertools.islice(sys.argv, 1, None)) |
124 | 124 | ||
125 | shouldClean = len(filter(lambda x: x == 'clean', parameters)) > 0 | 125 | shouldClean = len(filter(lambda x: x == 'clean', parameters)) > 0 |
126 | if (shouldClean): | 126 | if (shouldClean): |
127 | clean () | 127 | clean () |
128 | 128 | ||
129 | parameters = filter(lambda x: x != 'clean', parameters) | 129 | parameters = filter(lambda x: x != 'clean', parameters) |
130 | versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) | 130 | versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) |
131 | settings['versions'] = versions; #['debug', 'install'] | 131 | settings['versions'] = versions; #['debug', 'install'] |
132 | parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) | 132 | parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) |
133 | 133 | ||
134 | if len(parameters) > 0: | 134 | if len(parameters) > 0: |
135 | parameter = parameters.popleft() | 135 | parameter = parameters.popleft() |
136 | if parameter == "--ALL": | 136 | if parameter == "--ALL": |
137 | settings['frontends'] = ['beta', 'gamma', 'mobile'] | 137 | settings['frontends'] = ['beta', 'gamma', 'mobile'] |
138 | settings['backends'] = ['php', 'python', 'java'] | 138 | settings['backends'] = ['php', 'python', 'java'] |
139 | else: | 139 | else: |
140 | while parameter != None: | 140 | while parameter != None: |
141 | values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) | 141 | values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) |
142 | 142 | ||
143 | if parameter == "--backends": | 143 | if parameter == "--backends": |
144 | settings['backends'] = values | 144 | settings['backends'] = values |
145 | elif parameter == "--frontends": | 145 | elif parameter == "--frontends": |
146 | settings['frontends'] = values | 146 | settings['frontends'] = values |
147 | 147 | ||
148 | parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) | 148 | parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) |
149 | if parameters: | 149 | if parameters: |
150 | parameter = parameters.popleft() | 150 | parameter = parameters.popleft() |
151 | else: | 151 | else: |
152 | parameter = None | 152 | parameter = None |
153 | 153 | ||
154 | if (not settings.has_key('versions')): | 154 | if (not settings.has_key('versions')): |
155 | usage("missing 'versions'") | 155 | usage("missing 'versions'") |
156 | if (not settings.has_key('frontends')): | 156 | if (not settings.has_key('frontends')): |
157 | usage("missing 'frontends'") | 157 | usage("missing 'frontends'") |
158 | if (not settings.has_key('backends')): | 158 | if (not settings.has_key('backends')): |
159 | usage("missing 'backends'") | 159 | usage("missing 'backends'") |
160 | 160 | ||
161 | build (settings) | 161 | build (settings) |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | if __name__ == "__main__": | 165 | if __name__ == "__main__": |
166 | main() \ No newline at end of file | 166 | main() |