summaryrefslogtreecommitdiff
path: root/scripts/builder/backendBuilder.py
Side-by-side diff
Diffstat (limited to 'scripts/builder/backendBuilder.py') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/builder/backendBuilder.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/builder/backendBuilder.py b/scripts/builder/backendBuilder.py
index 36b28ca..20b4bd0 100644
--- a/scripts/builder/backendBuilder.py
+++ b/scripts/builder/backendBuilder.py
@@ -1,23 +1,27 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, json
import shutil
import hashlib
+from functools import reduce
+from operator import add
+from itertools import izip
+
import main
#===================================================================
class BackendBuilder(object):
def __init__ (self, projectTargetDir, frontends, versions, settings):
self.projectTargetDir = projectTargetDir
self.frontends = frontends
self.versions = versions
self.settings = settings
# --------------------------------------------------------------------------
def name (self):
raise NotImplementedError()
@@ -59,36 +63,41 @@ class BackendBuilder(object):
# --------------------------------------------------------------------------
def writeToFolder (self, folder, filename, content):
file = open(os.path.join(folder, filename), 'w')
file.write(content.encode('utf-8'))
file.close()
def configureIndexContent (self, indexContent, requestPathPrefix = ".."):
result = indexContent
result = result.replace( '@request.path@', requestPathPrefix + '/' + self.settings['request.path'] )
result = result.replace( '@should.pay.toll@', self.settings['should.pay.toll'] )
return result
+ def formatMAC (self, value):
+ x = iter(value)
+ return ' '.join([reduce(add, tup) for tup in izip(x, x, x, x)])
+
+
def logChecksums (self, content, message):
- md5Digest = hashlib.md5(content.encode('utf-8')).hexdigest()
- shaDigest = hashlib.sha1(content.encode('utf-8')).hexdigest()
- sha256Digest = hashlib.sha256(content.encode('utf-8')).hexdigest()
+ md5Digest = self.formatMAC(hashlib.md5(content.encode('utf-8')).hexdigest())
+ shaDigest = self.formatMAC(hashlib.sha1(content.encode('utf-8')).hexdigest())
+ sha256Digest = self.formatMAC(hashlib.sha256(content.encode('utf-8')).hexdigest())
print message + ": " + md5Digest + " (md5)"
print message + ": " + shaDigest + " (sha1)"
print message + ": " + sha256Digest + " (sha256)"
def shouldCompileCode (self):
return ('debug' in self.versions) or ('install' in self.versions)
def run (self):
print self.name() + " - RUN"
if self.shouldCompileCode():
self.compileCode()
for frontend in self.frontends: