diff options
author | Marco Pesenti Gritti <marco@marcopg.org> | 2009-01-20 17:21:49 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@marcopg.org> | 2009-01-20 17:21:49 (GMT) |
commit | 7cd4cee4819b134a195ffb26eae26032493ef6bd (patch) | |
tree | 5229ef759ec97f1123e21f2bb162d59e9d5d02cb /sjhbuild/bundlemodule.py | |
parent | ffe31992dd4796c576ab58b61d61bbb772b982f0 (diff) |
Some refactoring and fixes.
Diffstat (limited to 'sjhbuild/bundlemodule.py')
-rw-r--r-- | sjhbuild/bundlemodule.py | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/sjhbuild/bundlemodule.py b/sjhbuild/bundlemodule.py deleted file mode 100644 index 3a662c1..0000000 --- a/sjhbuild/bundlemodule.py +++ /dev/null @@ -1,94 +0,0 @@ -__metaclass__ = type - -import os - -from jhbuild.errors import BuildStateError -from jhbuild.modtypes import Package, get_branch, register_module_type - -__all__ = [ 'BundleModule' ] - -class BundleModule(Package): - type = 'bundle' - - STATE_CHECKOUT = 'checkout' - STATE_FORCE_CHECKOUT = 'force_checkout' - STATE_BUILD = 'build' - STATE_INSTALL = 'install' - - def __init__(self, name, branch, dependencies=[], after=[]): - Package.__init__(self, name, dependencies, after) - self.branch = branch - - def get_srcdir(self, buildscript): - return self.branch.srcdir - - def get_builddir(self, buildscript): - return self.get_srcdir(buildscript) - - def get_revision(self): - return self.branch.branchname - - def do_start(self, buildscript): - pass - do_start.next_state = STATE_CHECKOUT - do_start.error_states = [] - - def skip_checkout(self, buildscript, last_state): - # skip the checkout stage if the nonetwork flag is set - return buildscript.config.nonetwork - - def do_checkout(self, buildscript): - srcdir = self.get_srcdir(buildscript) - buildscript.set_action('Checking out', self) - self.branch.checkout(buildscript) - # did the checkout succeed? - if not os.path.exists(srcdir): - raise BuildStateError('source directory %s was not created' - % srcdir) - do_checkout.next_state = STATE_BUILD - do_checkout.error_states = [STATE_FORCE_CHECKOUT] - - def skip_force_checkout(self, buildscript, last_state): - return False - - def do_force_checkout(self, buildscript): - buildscript.set_action('Checking out', self) - self.branch.force_checkout(buildscript) - do_force_checkout.next_state = STATE_BUILD - do_force_checkout.error_states = [STATE_FORCE_CHECKOUT] - - def skip_build(self, buildscript, last_state): - return buildscript.config.nobuild - - def do_build(self, buildscript): - buildscript.set_action('Building', self) - srcdir = self.get_srcdir(buildscript) - builddir = self.get_builddir(buildscript) - python = os.environ.get('PYTHON', 'python') - cmd = [python, 'setup.py', 'build'] - buildscript.execute(cmd, cwd=srcdir) - do_build.next_state = STATE_INSTALL - do_build.error_states = [STATE_FORCE_CHECKOUT] - - def skip_install(self, buildscript, last_state): - return buildscript.config.nobuild - - def do_install(self, buildscript): - buildscript.set_action('Installing', self) - srcdir = self.get_srcdir(buildscript) - builddir = self.get_builddir(buildscript) - python = os.environ.get('PYTHON', 'python') - cmd = [python, 'setup.py', 'install'] - cmd.extend(['--prefix', buildscript.config.prefix]) - buildscript.execute(cmd, cwd=srcdir) - buildscript.packagedb.add(self.name, self.get_revision() or '') - do_install.next_state = Package.STATE_DONE - do_install.error_states = [] - - -def parse_bundle(node, config, uri, repositories, default_repo): - id = node.getAttribute('id') - branch = get_branch(node, repositories, default_repo, config) - return BundleModule(id, branch) - -register_module_type('bundle', parse_bundle) |