author | Clipperz <info@clipperz.com> | 2013-01-08 15:12:19 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-08 15:12:19 (UTC) |
commit | 25bd3085c5464862172c5bd921deca550185fe83 (patch) (unidiff) | |
tree | 2ea95bdd3606e9721fac81ab072d093fd46005fe /scripts/builder | |
parent | 596e94dca490619acced2e38fb3221cc7237b1ce (diff) | |
download | clipperz-25bd3085c5464862172c5bd921deca550185fe83.zip clipperz-25bd3085c5464862172c5bd921deca550185fe83.tar.gz clipperz-25bd3085c5464862172c5bd921deca550185fe83.tar.bz2 |
Updated builder script
-rw-r--r-- | scripts/builder/backendBuilder.py | 37 | ||||
-rw-r--r-- | scripts/builder/backends/devBuilder.py | 56 | ||||
-rw-r--r-- | scripts/builder/frontendBuilder.py | 44 | ||||
-rw-r--r-- | scripts/builder/frontends/betaBuilder.py | 14 | ||||
-rw-r--r-- | scripts/builder/frontends/gammaBuilder.py | 26 | ||||
-rw-r--r-- | scripts/builder/frontends/gamma_mobileBuilder.py | 9 | ||||
-rwxr-xr-x | scripts/builder/main.py | 26 | ||||
-rw-r--r-- | scripts/builder/repository.py | 11 |
8 files changed, 191 insertions, 32 deletions
diff --git a/scripts/builder/backendBuilder.py b/scripts/builder/backendBuilder.py index 5b91678..36b28ca 100644 --- a/scripts/builder/backendBuilder.py +++ b/scripts/builder/backendBuilder.py | |||
@@ -4,17 +4,16 @@ | |||
4 | import sys, os, json | 4 | import sys, os, json |
5 | import shutil | 5 | import shutil |
6 | import hashlib | 6 | import hashlib |
7 | 7 | ||
8 | import main | 8 | import main |
9 | 9 | ||
10 | #=================================================================== | 10 | #=================================================================== |
11 | 11 | ||
12 | |||
13 | class BackendBuilder(object): | 12 | class BackendBuilder(object): |
14 | 13 | ||
15 | def __init__ (self, projectTargetDir, frontends, versions, settings): | 14 | def __init__ (self, projectTargetDir, frontends, versions, settings): |
16 | self.projectTargetDir = projectTargetDir | 15 | self.projectTargetDir = projectTargetDir |
17 | self.frontends = frontends | 16 | self.frontends = frontends |
18 | self.versions = versions | 17 | self.versions = versions |
19 | self.settings = settings | 18 | self.settings = settings |
20 | 19 | ||
@@ -45,20 +44,22 @@ class BackendBuilder(object): | |||
45 | return os.path.join(self.projectTargetDir, '.tmp', self.relativePath()) | 44 | return os.path.join(self.projectTargetDir, '.tmp', self.relativePath()) |
46 | 45 | ||
47 | 46 | ||
48 | def frontEndTempFolder (self): | 47 | def frontEndTempFolder (self): |
49 | return self.tempFolder() | 48 | return self.tempFolder() |
50 | 49 | ||
51 | 50 | ||
52 | def developmentTargetFolder (self): | 51 | def developmentTargetFolder (self): |
53 | return os.path.join(self.projectTargetDir, 'development', self.relativePath()) | 52 | return os.path.join(self.projectTargetDir, 'development') |
53 | |||
54 | 54 | ||
55 | def targetFolder (self): | 55 | def targetFolder (self): |
56 | return os.path.join(self.projectTargetDir, self.relativePath()) | 56 | return os.path.join(self.projectTargetDir, self.relativePath()) |
57 | |||
57 | 58 | ||
58 | # -------------------------------------------------------------------------- | 59 | # -------------------------------------------------------------------------- |
59 | 60 | ||
60 | def writeToFolder (self, folder, filename, content): | 61 | def writeToFolder (self, folder, filename, content): |
61 | file = open(os.path.join(folder, filename), 'w') | 62 | file = open(os.path.join(folder, filename), 'w') |
62 | file.write(content.encode('utf-8')) | 63 | file.write(content.encode('utf-8')) |
63 | file.close() | 64 | file.close() |
64 | 65 | ||
@@ -98,34 +99,36 @@ class BackendBuilder(object): | |||
98 | 99 | ||
99 | main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module)) | 100 | main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module)) |
100 | 101 | ||
101 | if 'debug' in self.versions: | 102 | if 'debug' in self.versions: |
102 | frontend.copyResourcesToFolder(self.frontEndTempFolder()) | 103 | frontend.copyResourcesToFolder(self.frontEndTempFolder()) |
103 | 104 | ||
104 | index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')) | 105 | index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')) |
105 | self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug' + submoduleExtension + '.html'), index) | 106 | self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug' + submoduleExtension + '.html'), index) |
106 | 107 | ||
107 | if 'install' in self.versions: | 108 | if 'install' in self.versions: |
108 | index = self.configureIndexContent(frontend.assemble()) | 109 | index = self.configureIndexContent(frontend.assemble()) |
109 | self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) | 110 | self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) |
110 | 111 | ||
111 | self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum") | 112 | self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum") |
112 | 113 | ||
113 | self.createPackage() | 114 | self.createPackage() |
114 | 115 | ||
115 | if 'development' in self.versions: | 116 | # if 'development' in self.versions: |
116 | for frontend in self.frontends: | 117 | # for frontend in self.frontends: |
117 | if (frontend.module == frontend.submodule): | 118 | # if (frontend.module == frontend.submodule): |
118 | submoduleExtension = '' | 119 | # submoduleExtension = '' |
119 | else: | 120 | # else: |
120 | submoduleExtension = '.' + frontend.submodule | 121 | # submoduleExtension = '.' + frontend.submodule |
121 | 122 | # | |
122 | print "FRONTEND module: " + frontend.module | 123 | # print "FRONTEND module: " + frontend.module |
123 | print "FRONTEND submodule: " + frontend.submodule | 124 | # print "FRONTEND submodule: " + frontend.submodule |
124 | 125 | # | |
125 | main.createFolder(os.path.join(self.developmentTargetFolder(), frontend.module)) | 126 | ## main.createFolder(os.path.join(self.developmentTargetFolder(), frontend.module)) |
126 | 127 | # main.createFolder(self.developmentTargetFolder()) | |
127 | index = self.configureIndexContent(frontend.assemble(assemblyMode='DEVELOPMENT', versionType='DEBUG'), self.settings['development.settings']['url']) | 128 | # |
128 | self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) | 129 | # index = self.configureIndexContent(frontend.assemble(assemblyMode='DEVELOPMENT', versionType='DEBUG'), self.settings['development.settings']['url']) |
130 | ## self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index_development' + submoduleExtension + '.html'), index) | ||
131 | # self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module + submoduleExtension + '.html'), index) | ||
129 | 132 | ||
130 | 133 | ||
131 | #=================================================================== | 134 | #=================================================================== |
diff --git a/scripts/builder/backends/devBuilder.py b/scripts/builder/backends/devBuilder.py new file mode 100644 index 0000000..671765e --- a/dev/null +++ b/scripts/builder/backends/devBuilder.py | |||
@@ -0,0 +1,56 @@ | |||
1 | #!/usr/bin/env python | ||
2 | # -*- coding: UTF-8 -*- | ||
3 | |||
4 | import os | ||
5 | import shutil | ||
6 | import subprocess | ||
7 | import main | ||
8 | |||
9 | from backendBuilder import BackendBuilder | ||
10 | |||
11 | class DevBuilder(BackendBuilder): | ||
12 | |||
13 | def name(self): | ||
14 | return "Dev builder" | ||
15 | |||
16 | |||
17 | def relativePath(self): | ||
18 | return 'dev' | ||
19 | |||
20 | |||
21 | #def frontEndTempFolder (self): | ||
22 | # return os.path.join(self.tempFolder(), 'src', 'main', 'webapp') | ||
23 | |||
24 | |||
25 | #def targetFolder (self): | ||
26 | # return self.projectTargetDir | ||
27 | |||
28 | |||
29 | def compileCode (self): | ||
30 | pass | ||
31 | |||
32 | |||
33 | def createPackage (self): | ||
34 | src = self.tempFolder() | ||
35 | dst = self.targetFolder() | ||
36 | |||
37 | shutil.copytree(src, dst) | ||
38 | |||
39 | |||
40 | def run (self): | ||
41 | print self.name() + " - RUN (dev)" | ||
42 | |||
43 | for frontend in self.frontends: | ||
44 | if (frontend.module == frontend.submodule): | ||
45 | submoduleExtension = '' | ||
46 | else: | ||
47 | submoduleExtension = '.' + frontend.submodule | ||
48 | |||
49 | main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module)) | ||
50 | |||
51 | index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')) | ||
52 | self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) | ||
53 | |||
54 | self.createPackage() | ||
55 | |||
56 | |||
diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py index 1f0f92f..fc603c4 100644 --- a/scripts/builder/frontendBuilder.py +++ b/scripts/builder/frontendBuilder.py | |||
@@ -6,36 +6,51 @@ import cssmin | |||
6 | import jsmin | 6 | import jsmin |
7 | import codecs | 7 | import codecs |
8 | import shutil | 8 | import shutil |
9 | import StringIO | 9 | import StringIO |
10 | import urllib | 10 | import urllib |
11 | 11 | ||
12 | import main | 12 | import main |
13 | 13 | ||
14 | #=============================================================================== | ||
15 | |||
14 | class FrontendBuilder(object): | 16 | class FrontendBuilder(object): |
15 | 17 | ||
16 | def __init__ (self, frontend, settings, repositoryVersion): | 18 | def __init__ (self, frontend, settings, repositoryVersion): |
17 | if '.' in frontend: | 19 | if '.' in frontend: |
18 | moduleComponents = frontend.split('.') | 20 | moduleComponents = frontend.split('.') |
19 | self.module = moduleComponents[0] | 21 | self.module = moduleComponents[0] |
20 | self.submodule = moduleComponents[1] | 22 | self.submodule = moduleComponents[1] |
21 | else: | 23 | else: |
22 | self.module = frontend | 24 | self.module = frontend |
23 | self.submodule = frontend | 25 | self.submodule = frontend |
24 | 26 | ||
25 | self.settings = settings | 27 | self.settings = settings |
26 | self.projectDir = main.projectBaseDir() | 28 | self.projectDir = main.projectBaseDir() |
27 | # self.repository = repository.repositoryWithPath(self.projectDir) | 29 | # self.repository = repository.repositoryWithPath(self.projectDir) |
28 | self.repositoryVersion = repositoryVersion | 30 | self.repositoryVersion = repositoryVersion |
29 | self.processedFiles = {} | 31 | self.processedFiles = {} |
30 | 32 | ||
33 | #--------------------------------------------------------------------------- | ||
34 | |||
35 | def name (self): | ||
36 | raise NotImplementedError() | ||
37 | |||
38 | |||
39 | def copyStaticResources (self, targetFolder): | ||
40 | raise NotImplementedError() | ||
41 | |||
42 | #--------------------------------------------------------------------------- | ||
31 | 43 | ||
32 | def log (self, message): | 44 | def log (self, message): |
33 | print "frontend [" + self.module + "]: " + message | 45 | module = self.module |
46 | if (self.module != self.submodule): | ||
47 | module = module + "." + self.submodule | ||
48 | print "frontend [" + module + "]: " + message | ||
34 | 49 | ||
35 | 50 | ||
36 | def absolutePathForSources (self): | 51 | def absolutePathForSources (self): |
37 | return os.path.join(self.projectDir, 'frontend', self.module) | 52 | return os.path.join(self.projectDir, 'frontend', self.module) |
38 | 53 | ||
39 | 54 | ||
40 | def absolutePathForSourceFile (self, basePath, file): | 55 | def absolutePathForSourceFile (self, basePath, file): |
41 | return os.path.join(self.absolutePathForSources(), basePath, file) | 56 | return os.path.join(self.absolutePathForSources(), basePath, file) |
@@ -53,26 +68,40 @@ class FrontendBuilder(object): | |||
53 | pass | 68 | pass |
54 | else: | 69 | else: |
55 | result.append(file) | 70 | result.append(file) |
56 | 71 | ||
57 | return result | 72 | return result |
58 | 73 | ||
59 | 74 | ||
60 | def copyResources (self, sourceFolder, destinationFolder, fileType): | 75 | def copyResources (self, sourceFolder, destinationFolder, fileType): |
61 | for file in self.filterFiles(self.settings[fileType]): | 76 | if fileType in self.settings: |
62 | src = self.absolutePathForSourceFile(fileType, file) | 77 | for file in self.filterFiles(self.settings[fileType]): |
63 | dst = self.absolutePathForTargetFile(destinationFolder, fileType, file) | 78 | src = self.absolutePathForSourceFile(fileType, file) |
64 | main.createFolder(os.path.dirname(dst)) | 79 | dst = self.absolutePathForTargetFile(destinationFolder, fileType, file) |
65 | shutil.copy2(src, dst) | 80 | main.createFolder(os.path.dirname(dst)) |
81 | shutil.copy2(src, dst) | ||
82 | else: | ||
83 | srcFolder = os.path.join(self.absolutePathForSources(), fileType) | ||
84 | dstFolder = os.path.join(destinationFolder, self.module, fileType) | ||
85 | if not(os.path.exists(dstFolder)): | ||
86 | shutil.copytree(srcFolder, dstFolder) | ||
87 | |||
88 | # try: | ||
89 | # shutil.copytree(srcFolder, dstFolder) | ||
90 | # except: | ||
91 | # pass | ||
92 | |||
66 | 93 | ||
67 | 94 | ||
68 | def copyResourcesToFolder (self, targetFolder): | 95 | def copyResourcesToFolder (self, targetFolder): |
69 | self.copyResources(self.projectDir, targetFolder, 'css') | 96 | self.copyResources(self.projectDir, targetFolder, 'css') |
70 | self.copyResources(self.projectDir, targetFolder, 'js') | 97 | self.copyResources(self.projectDir, targetFolder, 'js') |
98 | self.copyResources(self.projectDir, targetFolder, 'images') | ||
99 | self.copyStaticResources(targetFolder) | ||
71 | 100 | ||
72 | 101 | ||
73 | def loadFilesContent (self, basePath, files): | 102 | def loadFilesContent (self, basePath, files): |
74 | result = "" | 103 | result = "" |
75 | 104 | ||
76 | for file in self.filterFiles(files): | 105 | for file in self.filterFiles(files): |
77 | try: | 106 | try: |
78 | fileHandler = codecs.open(self.absolutePathForSourceFile(basePath, file), 'r', 'utf-8') | 107 | fileHandler = codecs.open(self.absolutePathForSourceFile(basePath, file), 'r', 'utf-8') |
@@ -366,16 +395,17 @@ class FrontendBuilder(object): | |||
366 | 395 | ||
367 | elif assemblyMode == 'DEVELOPMENT': | 396 | elif assemblyMode == 'DEVELOPMENT': |
368 | copyright = "" | 397 | copyright = "" |
369 | css =self.cssTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'css')), self.filterFiles(self.settings['css'])) | 398 | css =self.cssTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'css')), self.filterFiles(self.settings['css'])) |
370 | js =self.scriptTagForContent(self.bookmarklet()) + \ | 399 | js =self.scriptTagForContent(self.bookmarklet()) + \ |
371 | '\n' + \ | 400 | '\n' + \ |
372 | self.scriptTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'js')), self.filterFiles(self.settings['js'])) | 401 | self.scriptTagsForFiles('file://' + str(os.path.join(self.absolutePathForSources(), 'js')), self.filterFiles(self.settings['js'])) |
373 | jsLoadMode = 'LINKED' | 402 | jsLoadMode = 'LINKED' |
403 | versionType = 'development' | ||
374 | 404 | ||
375 | else: | 405 | else: |
376 | raise NotImplementedError() | 406 | raise NotImplementedError() |
377 | 407 | ||
378 | return self.assembleVersion( | 408 | return self.assembleVersion( |
379 | pageTitle = pageTitle, | 409 | pageTitle = pageTitle, |
380 | copyright = copyright, | 410 | copyright = copyright, |
381 | css = css, | 411 | css = css, |
diff --git a/scripts/builder/frontends/betaBuilder.py b/scripts/builder/frontends/betaBuilder.py new file mode 100644 index 0000000..c5a3e76 --- a/dev/null +++ b/scripts/builder/frontends/betaBuilder.py | |||
@@ -0,0 +1,14 @@ | |||
1 | from frontendBuilder import FrontendBuilder | ||
2 | import shutil | ||
3 | |||
4 | class BetaBuilder(FrontendBuilder): | ||
5 | |||
6 | def name(self): | ||
7 | return "/beta builder" | ||
8 | |||
9 | def copyStaticResources (self, targetFolder): | ||
10 | for file in self.filterFiles(self.settings['staticResources']): | ||
11 | src = self.absolutePathForSourceFile('staticResources', file) | ||
12 | dst = self.absolutePathForTargetFile(targetFolder, '', file) | ||
13 | shutil.copy2(src, dst) | ||
14 | |||
diff --git a/scripts/builder/frontends/gammaBuilder.py b/scripts/builder/frontends/gammaBuilder.py new file mode 100644 index 0000000..35fa68b --- a/dev/null +++ b/scripts/builder/frontends/gammaBuilder.py | |||
@@ -0,0 +1,26 @@ | |||
1 | from frontendBuilder import FrontendBuilder | ||
2 | import shutil | ||
3 | |||
4 | class GammaBuilder(FrontendBuilder): | ||
5 | |||
6 | def name(self): | ||
7 | return "/gamma builder" | ||
8 | |||
9 | def copyStaticResources (self, targetFolder): | ||
10 | resourcesToCopy = [ | ||
11 | {'folder': 'html', 'source': 'exit_template.html','target': 'exit.html'}, | ||
12 | {'folder': 'css', 'source': 'static.css', 'target': 'static.css'} | ||
13 | ] | ||
14 | |||
15 | for resource in resourcesToCopy: | ||
16 | src = self.absolutePathForSourceFile(resource['folder'], resource['source']) | ||
17 | dst = self.absolutePathForTargetFile(targetFolder, '', resource['target']) | ||
18 | shutil.copy2(src, dst) | ||
19 | |||
20 | # src = self.absolutePathForSourceFile('html', 'exit_template.html') | ||
21 | # dst = self.absolutePathForTargetFile(targetFolder, '', 'exit.html') | ||
22 | # shutil.copy2(src, dst) | ||
23 | |||
24 | # src = self.absolutePathForSourceFile('css', 'static.css') | ||
25 | # dst = self.absolutePathForTargetFile(targetFolder, '', 'static.css') | ||
26 | # shutil.copy2(src, dst) | ||
diff --git a/scripts/builder/frontends/gamma_mobileBuilder.py b/scripts/builder/frontends/gamma_mobileBuilder.py new file mode 100644 index 0000000..f2e80c9 --- a/dev/null +++ b/scripts/builder/frontends/gamma_mobileBuilder.py | |||
@@ -0,0 +1,9 @@ | |||
1 | from frontendBuilder import FrontendBuilder | ||
2 | |||
3 | class Gamma_MobileBuilder(FrontendBuilder): | ||
4 | |||
5 | def name(self): | ||
6 | return "/gamma.mobile builder" | ||
7 | |||
8 | def copyStaticResources (self, targetFolder): | ||
9 | pass | ||
diff --git a/scripts/builder/main.py b/scripts/builder/main.py index 6fce65d..b9fe04a 100755 --- a/scripts/builder/main.py +++ b/scripts/builder/main.py | |||
@@ -5,17 +5,17 @@ import sys | |||
5 | import os | 5 | import os |
6 | import json | 6 | import json |
7 | import shutil | 7 | import shutil |
8 | import pprint | 8 | import pprint |
9 | import codecs | 9 | import codecs |
10 | import itertools | 10 | import itertools |
11 | from collections import deque | 11 | from collections import deque |
12 | 12 | ||
13 | import frontendBuilder | 13 | #import frontendBuilder |
14 | import repository | 14 | import repository |
15 | 15 | ||
16 | pp = pprint.PrettyPrinter(indent=4, depth=4) | 16 | pp = pprint.PrettyPrinter(indent=4, depth=4) |
17 | 17 | ||
18 | #-------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------- |
19 | 19 | ||
20 | def scriptDir (): | 20 | def scriptDir (): |
21 | return os.path.dirname(sys.argv[0]) | 21 | return os.path.dirname(sys.argv[0]) |
@@ -70,33 +70,45 @@ def loadSettings (component, module): | |||
70 | # | 70 | # |
71 | #==================================================================== | 71 | #==================================================================== |
72 | 72 | ||
73 | def assembleBackend (backend, frontends, versions): | 73 | def assembleBackend (backend, frontends, versions): |
74 | settings = loadSettings('backend', backend) | 74 | settings = loadSettings('backend', backend) |
75 | 75 | ||
76 | builderModuleName = backend + 'Builder' | 76 | builderModuleName = backend + 'Builder' |
77 | builderClassName = backend.capitalize() + 'Builder' | 77 | builderClassName = backend.capitalize() + 'Builder' |
78 | 78 | #print ("BUILD BACKENDS - module: " + builderModuleName + " , class: " + builderClassName) | |
79 | builderModule = __import__(builderModuleName) | 79 | builderModule = __import__(builderModuleName) |
80 | builderClass = getattr(builderModule, builderClassName) | 80 | builderClass = getattr(builderModule, builderClassName) |
81 | 81 | ||
82 | backendBuilder = builderClass(projectTargetDir(), frontends, versions, settings) | 82 | backendBuilder = builderClass(projectTargetDir(), frontends, versions, settings) |
83 | backendBuilder.run() | 83 | backendBuilder.run() |
84 | 84 | ||
85 | #==================================================================== | 85 | #==================================================================== |
86 | 86 | ||
87 | def build (settings, repository): | 87 | def build (settings, repository): |
88 | frontends = [] | 88 | frontends = [] |
89 | 89 | ||
90 | if repository.areTherePendingChanges(): | 90 | if repository.areTherePendingChanges(): |
91 | print "\nWARNING: repository has pending changes\n" | 91 | if 'install' in settings['versions']: |
92 | raise Exception("repository has pending changes, can't 'install'") | ||
93 | else: | ||
94 | print "\nWARNING: repository has pending changes\n" | ||
92 | 95 | ||
93 | for frontend in settings['frontends']: | 96 | for frontend in settings['frontends']: |
94 | frontends.append(frontendBuilder.FrontendBuilder(frontend, loadSettings('frontend', frontend), repository.version())) | 97 | normalizedFrontendName = frontend.replace(".", "_") |
98 | builderModuleName = normalizedFrontendName + 'Builder' | ||
99 | builderClassName = normalizedFrontendName.title() + 'Builder' | ||
100 | |||
101 | #print ("BUILD FRONTEND - module: " + builderModuleName + " , class: " + builderClassName) | ||
102 | builderModule = __import__(builderModuleName) | ||
103 | builderClass = getattr(builderModule, builderClassName) | ||
104 | builder = builderClass(frontend, loadSettings('frontend', frontend), repository.version()) | ||
105 | #builder = frontendBuilder.FrontendBuilder(frontend, loadSettings('frontend', frontend), repository.version()) | ||
106 | frontends.append(builder) | ||
95 | 107 | ||
96 | for backend in settings['backends']: | 108 | for backend in settings['backends']: |
97 | assembleBackend(backend, frontends, settings['versions']) | 109 | assembleBackend(backend, frontends, settings['versions']) |
98 | 110 | ||
99 | #-------------------------------------------------------------------- | 111 | #-------------------------------------------------------------------- |
100 | 112 | ||
101 | def clean (): | 113 | def clean (): |
102 | # print "cleaning up …" | 114 | # print "cleaning up …" |
@@ -109,36 +121,38 @@ def usage (message): | |||
109 | if message != None: | 121 | if message != None: |
110 | print "ERROR: " + message | 122 | print "ERROR: " + message |
111 | 123 | ||
112 | 124 | ||
113 | # print "build clean" | 125 | # print "build clean" |
114 | # print "build clean install" | 126 | # print "build clean install" |
115 | print "build install --ALL" | 127 | print "build install --ALL" |
116 | print "build install debug --ALL" | 128 | print "build install debug --ALL" |
129 | print "build install debug development --ALL" | ||
117 | # print "build clean install debug --ALL" | 130 | # print "build clean install debug --ALL" |
118 | print "build install debug --backends php python --frontends beta gamma" | 131 | print "build install debug --backends php python --frontends beta gamma" |
119 | print "build install debug development --backends php python --frontends beta gamma gamma.mobile" | 132 | print "build install debug development --backends php python --frontends beta gamma gamma.mobile" |
120 | exit(1) | 133 | exit(1) |
121 | 134 | ||
122 | #-------------------------------------------------------------------- | 135 | #-------------------------------------------------------------------- |
123 | 136 | ||
124 | def allFrontends (): | 137 | def allFrontends (): |
125 | return ['beta', 'gamma', 'mobile'] | 138 | return ['beta', 'gamma', 'gamma.mobile'] |
126 | 139 | ||
127 | def allBackends (): | 140 | def allBackends (): |
128 | return ['php', 'python'] | 141 | return ['php', 'python'] |
129 | 142 | ||
130 | #-------------------------------------------------------------------- | 143 | #-------------------------------------------------------------------- |
131 | 144 | ||
132 | def main (): | 145 | def main (): |
133 | settings = {} | 146 | settings = {} |
134 | parameters = list(itertools.islice(sys.argv, 1, None)) | 147 | parameters = list(itertools.islice(sys.argv, 1, None)) |
135 | 148 | ||
136 | sys.path.append(os.path.join(scriptDir(), 'backends')) | 149 | sys.path.append(os.path.join(scriptDir(), 'backends')) |
150 | sys.path.append(os.path.join(scriptDir(), 'frontends')) | ||
137 | currentRepository = repository.repositoryWithPath(projectBaseDir()) | 151 | currentRepository = repository.repositoryWithPath(projectBaseDir()) |
138 | 152 | ||
139 | clean() | 153 | clean() |
140 | versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) | 154 | versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) |
141 | settings['versions'] = versions; #['debug', 'install', 'development'] | 155 | settings['versions'] = versions; #['debug', 'install', 'development'] |
142 | parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) | 156 | parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) |
143 | 157 | ||
144 | if len(parameters) > 0: | 158 | if len(parameters) > 0: |
@@ -169,9 +183,9 @@ def main (): | |||
169 | usage("missing 'backends'") | 183 | usage("missing 'backends'") |
170 | 184 | ||
171 | build(settings, currentRepository) | 185 | build(settings, currentRepository) |
172 | else: | 186 | else: |
173 | usage("Suggestions on how to call the 'build' script:") | 187 | usage("Suggestions on how to call the 'build' script:") |
174 | 188 | ||
175 | 189 | ||
176 | if __name__ == "__main__": | 190 | if __name__ == "__main__": |
177 | main() | 191 | main() |
diff --git a/scripts/builder/repository.py b/scripts/builder/repository.py index 0045de7..a47e249 100644 --- a/scripts/builder/repository.py +++ b/scripts/builder/repository.py | |||
@@ -51,21 +51,28 @@ class Repository(object): | |||
51 | 51 | ||
52 | #=================================================================== | 52 | #=================================================================== |
53 | 53 | ||
54 | 54 | ||
55 | class GitRepository(Repository): | 55 | class GitRepository(Repository): |
56 | #http://gitorious.org/git-python | 56 | #http://gitorious.org/git-python |
57 | 57 | ||
58 | def revision (self): | 58 | def revision (self): |
59 | return self.repository.head.commit.hexsha | 59 | try: |
60 | return self.repository.head.commit.hexsha | ||
61 | except: | ||
62 | return self.repository.commits()[0].id | ||
60 | 63 | ||
61 | 64 | ||
62 | def areTherePendingChanges (self): | 65 | def areTherePendingChanges (self): |
63 | return self.repository.is_dirty() | 66 | try: |
67 | return self.repository.is_dirty() | ||
68 | except TypeError, te: | ||
69 | return self.repository.is_dirty | ||
70 | |||
64 | 71 | ||
65 | 72 | ||
66 | #=================================================================== | 73 | #=================================================================== |
67 | 74 | ||
68 | 75 | ||
69 | class HgRepository(Repository): | 76 | class HgRepository(Repository): |
70 | #http://mercurial.selenic.com/wiki/MercurialApi | 77 | #http://mercurial.selenic.com/wiki/MercurialApi |
71 | 78 | ||