X-Git-Url: https://git.ralfj.de/mass-build.git/blobdiff_plain/546c80d1c559cb94223f9c459db719d143df7291..6809794087ce061ac5a0626c3f4c855c6e1b8f14:/build_system.py?ds=sidebyside diff --git a/build_system.py b/build_system.py index e18d9ff..073d432 100644 --- a/build_system.py +++ b/build_system.py @@ -7,14 +7,13 @@ class CMake: 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 @@ -27,13 +26,27 @@ class CMake: 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