summaryrefslogtreecommitdiff
path: root/scripts
Side-by-side diff
Diffstat (limited to 'scripts') (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,49 +1,49 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, json
import shutil
import main
import hashlib
class BackendBuilder:
def __init__ (self, projectTargetDir, frontends, versions, settings):
self.projectTargetDir = projectTargetDir
self.frontends = frontends
self.versions = versions
self.settings = settings
def name (self):
raise NotImplementedError()
def relativePath (self):
raise NotImplementedError()
def compileCode (self):
pass
def copyCompiledCodeToTargetDir (self):
src = self.sourceFolder()
dst = self.targetFolder()
main.createFolder(os.path.dirname(dst))
shutil.copytree(src, dst)
def sourceFolder (self):
return main.projectBaseDir() + '/backend/' + self.relativePath() + '/src'
def targetFolder (self):
return self.projectTargetDir + self.relativePath()
def createTargetFolder (self):
main.createFolder(self.targetFolder())
# def copyFrontendResources (self, frontend):
# print "copying resources for frontend: " + frontend
# print "SETTINGS: " + str(self.settings)
def writeToTargetFolder (self, filename, content):
file = open(self.targetFolder() + '/' + filename, 'w')
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,49 +1,49 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, re
import cssmin
import jsmin
import codecs
import shutil
import StringIO
import urllib
#from mercurial import ui, hg
#from mercurial.node import hex
from dulwich.repo import Repo
import main
class FrontendBuilder:
def __init__ (self, frontend, settings):
if '.' in frontend:
moduleComponents = frontend.split('.')
self.module = moduleComponents[0]
self.submodule = moduleComponents[1]
else:
self.module = frontend
self.submodule = frontend
self.settings = settings
self.projectDir = main.projectBaseDir()
self.processedFiles = {}
def mercurialRepositoryVersion (self):
repo = hg.repository(ui.ui(), self.projectDir)
context = repo['tip']
result = str(context)
return result
def gitRepositoryVersion (self):
repo = Repo(self.projectDir)
#if repo.is_dirty():
# print "WARNING: build run with dirty repository"
result = repo.refs['HEAD']
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 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, json
import shutil
import pprint
import frontendBuilder
import codecs
import itertools
from collections import deque
from phpBuilder import PhpBuilder
from pythonBuilder import PythonBuilder
pp = pprint.PrettyPrinter(indent=4, depth=4)
#--------------------------------------------------------------------
def scriptDir ():
return os.path.dirname(sys.argv[0])
def projectBaseDir ():
return os.path.abspath(scriptDir() + '/../..')
def projectTargetDir():
return projectBaseDir() + '/target/'
#--------------------------------------------------------------------
def createFolder (path):
if not os.path.exists(path):
os.makedirs(path)
#--------------------------------------------------------------------
def loadSettings (component, module):
print "MODULE: " + module
if '.' in module:
moduleComponents = module.split('.')
module = moduleComponents[0]
submodule = moduleComponents[1]
else:
submodule = module
settings = codecs.open(projectBaseDir() + '/' + component + '/' + module + '/properties/' + submodule + '.properties.json', 'r', 'utf-8')
result = json.load(settings)
settings.close
@@ -118,49 +118,49 @@ def usage (message):
#--------------------------------------------------------------------
def main ():
settings = {}
parameters = list(itertools.islice(sys.argv, 1, None))
shouldClean = len(filter(lambda x: x == 'clean', parameters)) > 0
if (shouldClean):
clean ()
parameters = filter(lambda x: x != 'clean', parameters)
versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
settings['versions'] = versions; #['debug', 'install']
parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
if len(parameters) > 0:
parameter = parameters.popleft()
if parameter == "--ALL":
settings['frontends'] = ['beta', 'gamma', 'mobile']
settings['backends'] = ['php', 'python', 'java']
else:
while parameter != None:
values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
if parameter == "--backends":
settings['backends'] = values
elif parameter == "--frontends":
settings['frontends'] = values
parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
if parameters:
parameter = parameters.popleft()
else:
parameter = None
if (not settings.has_key('versions')):
usage("missing 'versions'")
if (not settings.has_key('frontends')):
usage("missing 'frontends'")
if (not settings.has_key('backends')):
usage("missing 'backends'")
build (settings)
if __name__ == "__main__":
- main() \ No newline at end of file
+ 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 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from backendBuilder import BackendBuilder
class PhpBuilder(BackendBuilder):
def name(self):
return "PHP builder"
def relativePath(self):
return 'php'
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 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from backendBuilder import BackendBuilder
class PythonBuilder(BackendBuilder):
def name(self):
return "Python builder"
def relativePath(self):
return 'python'