#!/usr/bin/env python import os import sys import dependency from dependency import LibDependency def update_jhbuild(): print 'Updating jhbuild...' sys.path.append(os.path.join(base_dir)) os.chdir(build_scripts_dir) cmd = ['svn', 'co', 'svn://svn.gnome.org/svn/jhbuild/trunk', 'jhbuild'] os.spawnvp(os.P_WAIT, 'svn', cmd) os.chdir(exec_dir) def configure(): config_file = os.path.join(build_scripts_dir, 'olpc.jhbuildrc') return jhbuild.config.Config(config_file) exec_dir = os.getcwd() base_dir = os.path.abspath(os.path.dirname(__file__)) build_scripts_dir = os.path.join(base_dir, 'build-scripts') if len(sys.argv) > 1: command = sys.argv[1] args = sys.argv[2:] else: command = 'build' args = sys.argv[1:] if command == 'build': update_jhbuild() # System dependencies skip_modules = [ 'libglade', 'libXrender', 'libxml2', 'shared-mime-info', 'fontconfig', 'gtk-doc', 'startup-notification', 'libXft' ] if LibDependency('xulrunner', 'xulrunner-gtkmozembed').check(): skip_modules.append('mozilla') sys.path.append(os.path.join(build_scripts_dir, 'jhbuild')) import jhbuild.config import jhbuild.commands import bundlemodule config = configure() for module in skip_modules: config.skip.append(module) jhbuild.config.addpath('XDG_DATA_DIRS', '/usr/share') path = 'lib/python2.4/site-packages' jhbuild.config.addpath('PYTHONPATH', os.path.join(config.prefix, path)) path = 'lib/gtk-2.0/' jhbuild.config.addpath('GTK_PATH', os.path.join(config.prefix, path)) path = 'etc/gtk-2.0/gtkrc' jhbuild.config.addpath('GTK2_RC_FILES', os.path.join(config.prefix, path)) if command == 'run' and len(args) == 0: jhbuild.commands.run(command, config, ['sugar-emulator']) else: jhbuild.commands.run(command, config, args)