def __init__(self, sourceFolder, buildFolder, config):
self.sourceFolder = os.path.abspath(sourceFolder)
self.buildFolder = os.path.abspath(buildFolder)
- self.installDir = config.installDir
- self.buildType = config.buildType
- self.jobs = config.jobs
- self.buildCmdPrefix = config.buildCmdPrefix
- self.installCmdPrefix = config.installCmdPrefix
+ self.installDir = config['installDir']
+ self.buildType = config['buildType']
+ self.jobs = config['jobs']
+ self.buildCmdPrefix = config['buildCmdPrefix']
+ self.installCmdPrefix = config['installCmdPrefix']
def configure(self, force=False):
- print "Configuring",self.sourceFolder
if not os.path.exists(self.buildFolder): os.makedirs(self.buildFolder)
os.chdir(self.buildFolder)
# check if we actually need to work
os.unsetenv('PKG_CONFIG_PATH')
def build(self):
- print "Building",self.sourceFolder
os.chdir(self.buildFolder)
subprocess.check_call(self.buildCmdPrefix + ['make', '-j'+str(self.jobs)])
def install(self):
- print "Installing",self.sourceFolder
os.chdir(self.buildFolder)
subprocess.check_call(self.installCmdPrefix + ['make', 'install'])
-# TODO: class Debian, which creates & install a debian package
+# if auto-debuild is available, provide a wrapper for it
+try:
+ import auto_debuild
+ class AutoDebuild:
+ def __init__(self, sourceFolder, module):
+ self.autoDebuildConfig = {}
+
+ def configure(self, force=False): # force is ignored
+ self.files = auto_debuild.createDebianFiles(self.autoDebuildConfig)
+
+ def build(self):
+ auto_debuild.buildDebianPackage(self.autoDebuildConfig)
+
+ def install(self):
+ subprocess.check_call(['sudo', 'dpkg', '--install'] + self.files)
+except ImportError:
+ pass