QuasarAppCI/BuildBotLib/basemodule.py

46 lines
884 B
Python
Raw Normal View History

2019-07-22 10:20:59 +03:00
from buildbot.plugins import util
import multiprocessing
import glob
import shutil
2019-12-26 11:29:22 +03:00
2019-10-06 19:15:02 +03:00
class BaseModule:
2019-12-25 19:35:31 +03:00
MULTIPLE_SH_COMMAND = ["/bin/bash", "-c"]
2019-10-06 19:15:02 +03:00
def __init__(self):
2019-12-26 11:29:22 +03:00
self
def generateCmd(self, bashString):
return self.MULTIPLE_SH_COMMAND + [bashString]
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def getFactory(self):
return util.BuildFactory()
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def getRepo(self):
2019-12-26 11:29:22 +03:00
return ""
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def getPropertyes(self):
return []
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
def copyRegExp(self, source, dist):
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
res = []
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
for file in glob.glob(source):
res.append(file)
shutil.copy(file, dist)
2019-07-22 10:20:59 +03:00
2019-12-26 11:29:22 +03:00
return res
2019-07-22 10:20:59 +03:00
2019-10-06 19:15:02 +03:00
@util.renderer
def makeCommand(self, props):
command = ['make']
cpus = multiprocessing.cpu_count()
if cpus:
command.extend(['-j', str(cpus)])
else:
command.extend(['-j', '1'])
return command