summaryrefslogtreecommitdiff
authorAntonio Lima <anto87@gmail.com>2011-10-05 08:24:32 (UTC)
committer Antonio Lima <anto87@gmail.com>2011-10-05 08:24:32 (UTC)
commit2a98e81b954ab84efc8d3f4e1d837bf190f77d7d (patch) (unidiff)
tree8aa49a97a01d40737fbd8fa5c1f519f7a26d607b
parent3065be1b71e4c40428cfa192de560c970ba7f8b3 (diff)
downloadclipperz-2a98e81b954ab84efc8d3f4e1d837bf190f77d7d.zip
clipperz-2a98e81b954ab84efc8d3f4e1d837bf190f77d7d.tar.gz
clipperz-2a98e81b954ab84efc8d3f4e1d837bf190f77d7d.tar.bz2
Fixing python path of builder scripts for environment support
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/builder/backendBuilder.py2
-rw-r--r--scripts/builder/frontendBuilder.py2
-rwxr-xr-xscripts/builder/main.py4
-rw-r--r--scripts/builder/phpBuilder.py2
-rw-r--r--scripts/builder/pythonBuilder.py2
5 files changed, 6 insertions, 6 deletions
diff --git a/scripts/builder/backendBuilder.py b/scripts/builder/backendBuilder.py
index f5dc7b2..16dbe2f 100644
--- a/scripts/builder/backendBuilder.py
+++ b/scripts/builder/backendBuilder.py
@@ -1,33 +1,33 @@
1#!/usr/bin/python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4import sys, os, json 4import sys, os, json
5import shutil 5import shutil
6import main 6import main
7import hashlib 7import hashlib
8 8
9class BackendBuilder: 9class BackendBuilder:
10 10
11 def __init__ (self, projectTargetDir, frontends, versions, settings): 11 def __init__ (self, projectTargetDir, frontends, versions, settings):
12 self.projectTargetDir = projectTargetDir 12 self.projectTargetDir = projectTargetDir
13 self.frontends = frontends 13 self.frontends = frontends
14 self.versions = versions 14 self.versions = versions
15 self.settings = settings 15 self.settings = settings
16 16
17 def name (self): 17 def name (self):
18 raise NotImplementedError() 18 raise NotImplementedError()
19 19
20 def relativePath (self): 20 def relativePath (self):
21 raise NotImplementedError() 21 raise NotImplementedError()
22 22
23 def compileCode (self): 23 def compileCode (self):
24 pass 24 pass
25 25
26 def copyCompiledCodeToTargetDir (self): 26 def copyCompiledCodeToTargetDir (self):
27 src = self.sourceFolder() 27 src = self.sourceFolder()
28 dst = self.targetFolder() 28 dst = self.targetFolder()
29 main.createFolder(os.path.dirname(dst)) 29 main.createFolder(os.path.dirname(dst))
30 shutil.copytree(src, dst) 30 shutil.copytree(src, dst)
31 31
32 def sourceFolder (self): 32 def sourceFolder (self):
33 return main.projectBaseDir() + '/backend/' + self.relativePath() + '/src' 33 return main.projectBaseDir() + '/backend/' + self.relativePath() + '/src'
diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py
index b796438..55054ee 100644
--- a/scripts/builder/frontendBuilder.py
+++ b/scripts/builder/frontendBuilder.py
@@ -1,33 +1,33 @@
1#!/usr/bin/python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4import sys, os, re 4import sys, os, re
5import cssmin 5import cssmin
6import jsmin 6import jsmin
7import codecs 7import codecs
8import shutil 8import shutil
9import StringIO 9import StringIO
10import urllib 10import urllib
11 11
12#from mercurial import ui, hg 12#from mercurial import ui, hg
13#from mercurial.node import hex 13#from mercurial.node import hex
14from dulwich.repo import Repo 14from dulwich.repo import Repo
15 15
16import main 16import main
17 17
18 18
19 19
20class FrontendBuilder: 20class FrontendBuilder:
21 21
22 def __init__ (self, frontend, settings): 22 def __init__ (self, frontend, settings):
23 if '.' in frontend: 23 if '.' in frontend:
24 moduleComponents = frontend.split('.') 24 moduleComponents = frontend.split('.')
25 self.module = moduleComponents[0] 25 self.module = moduleComponents[0]
26 self.submodule = moduleComponents[1] 26 self.submodule = moduleComponents[1]
27 else: 27 else:
28 self.module = frontend 28 self.module = frontend
29 self.submodule = frontend 29 self.submodule = frontend
30 30
31 self.settings = settings 31 self.settings = settings
32 self.projectDir = main.projectBaseDir() 32 self.projectDir = main.projectBaseDir()
33 self.processedFiles = {} 33 self.processedFiles = {}
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,33 +1,33 @@
1#!/usr/bin/python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4import sys, os, json 4import sys, os, json
5import shutil 5import shutil
6import pprint 6import pprint
7import frontendBuilder 7import frontendBuilder
8import codecs 8import codecs
9import itertools 9import itertools
10 10
11from collections import deque 11from collections import deque
12from phpBuilder import PhpBuilder 12from phpBuilder import PhpBuilder
13from pythonBuilder import PythonBuilder 13from pythonBuilder import PythonBuilder
14 14
15pp = pprint.PrettyPrinter(indent=4, depth=4) 15pp = pprint.PrettyPrinter(indent=4, depth=4)
16 16
17#-------------------------------------------------------------------- 17#--------------------------------------------------------------------
18 18
19def scriptDir (): 19def scriptDir ():
20 return os.path.dirname(sys.argv[0]) 20 return os.path.dirname(sys.argv[0])
21 21
22def projectBaseDir (): 22def projectBaseDir ():
23 return os.path.abspath(scriptDir() + '/../..') 23 return os.path.abspath(scriptDir() + '/../..')
24 24
25def projectTargetDir(): 25def projectTargetDir():
26 return projectBaseDir() + '/target/' 26 return projectBaseDir() + '/target/'
27 27
28#-------------------------------------------------------------------- 28#--------------------------------------------------------------------
29 29
30def createFolder (path): 30def 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
@@ -134,33 +134,33 @@ def main ():
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
165if __name__ == "__main__": 165if __name__ == "__main__":
166 main() \ No newline at end of file 166 main()
diff --git a/scripts/builder/phpBuilder.py b/scripts/builder/phpBuilder.py
index 9512192..cb4661d 100644
--- a/scripts/builder/phpBuilder.py
+++ b/scripts/builder/phpBuilder.py
@@ -1,14 +1,14 @@
1#!/usr/bin/python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4from backendBuilder import BackendBuilder 4from backendBuilder import BackendBuilder
5 5
6class PhpBuilder(BackendBuilder): 6class PhpBuilder(BackendBuilder):
7 7
8 def name(self): 8 def name(self):
9 return "PHP builder" 9 return "PHP builder"
10 10
11 def relativePath(self): 11 def relativePath(self):
12 return 'php' 12 return 'php'
13 13
14 14
diff --git a/scripts/builder/pythonBuilder.py b/scripts/builder/pythonBuilder.py
index 44c62a8..a84598d 100644
--- a/scripts/builder/pythonBuilder.py
+++ b/scripts/builder/pythonBuilder.py
@@ -1,14 +1,14 @@
1#!/usr/bin/python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4from backendBuilder import BackendBuilder 4from backendBuilder import BackendBuilder
5 5
6class PythonBuilder(BackendBuilder): 6class PythonBuilder(BackendBuilder):
7 7
8 def name(self): 8 def name(self):
9 return "Python builder" 9 return "Python builder"
10 10
11 def relativePath(self): 11 def relativePath(self):
12 return 'python' 12 return 'python'
13 13
14 14