Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-01-21 11:36:15 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-01-21 11:36:15 (GMT)
commiteb200d2facbe5617e2ee5ebdf7cab111ee549f26 (patch)
tree0617b20f0e34d851e59699320a667788f6860e3b
parentcf7fe419fd76c8d38171959bc8b9106142e4cd11 (diff)
Start rewriting the main script. Split configuration out to a jhbuild.config.Config subclass.
-rw-r--r--config.py45
-rwxr-xr-xsugar-jhbuild72
2 files changed, 51 insertions, 66 deletions
diff --git a/config.py b/config.py
new file mode 100644
index 0000000..9fee210
--- /dev/null
+++ b/config.py
@@ -0,0 +1,45 @@
+import os
+
+import jhbuild.config
+
+class Config(jhbuild.config.Config):
+ def __init__(self, base_dir):
+ self._base_dir = base_dir
+
+ rc = os.path.expanduser('~/.olpc.jhbuildrc')
+ jhbuild.config.Config.__init__(self, rc)
+
+ self._setup()
+
+ def _setup(self):
+ self.moduleset = []
+ self._add_moduleset('sugar-base.modules')
+
+ self.modules = [ 'meta-sugar-base' ]
+
+ self.checkoutroot = os.path.join(self._base_dir, 'source')
+
+ def _add_moduleset(self, set):
+ set_path = os.path.join(self._base_dir, 'build-scripts', set)
+ self.moduleset.append(set_path)
+
+ def setup_env(self):
+ self.prefix = os.path.join(self._base_dir, 'build')
+
+ jhbuild.config.Config.setup_env(self)
+
+ jhbuild.config.addpath('XDG_DATA_DIRS', '/usr/share')
+
+ path = 'lib/python2.4/site-packages'
+ jhbuild.config.addpath('PYTHONPATH',
+ os.path.join(self.prefix, path))
+
+ path = 'lib/gtk-2.0/'
+ jhbuild.config.addpath('GTK_PATH',
+ os.path.join(self.prefix, path))
+
+ path = 'etc/gtk-2.0/gtkrc'
+ jhbuild.config.addpath('GTK2_RC_FILES',
+ os.path.join(self.prefix, path))
+
+ jhbuild.config.addpath('SUGAR_PREFIX', self.prefix)
diff --git a/sugar-jhbuild b/sugar-jhbuild
index cd659ab..aecca99 100755
--- a/sugar-jhbuild
+++ b/sugar-jhbuild
@@ -3,27 +3,14 @@
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)
+base_dir = os.path.abspath(os.path.dirname(__file__))
+sys.path.append(os.path.join(base_dir, 'build-scripts', 'jhbuild'))
- os.chdir(exec_dir)
+import jhbuild.commands
-def configure():
- config_file = os.path.join(build_scripts_dir, 'olpc.jhbuildrc')
- return jhbuild.config.Config(config_file)
+from config import Config
-exec_dir = os.getcwd()
-base_dir = os.path.abspath(os.path.dirname(__file__))
-build_scripts_dir = os.path.join(base_dir, 'build-scripts')
+config = Config(base_dir)
if len(sys.argv) > 1:
command = sys.argv[1]
@@ -32,51 +19,4 @@ 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))
-
-jhbuild.config.addpath('SUGAR_PREFIX', config.prefix)
-
-if command == 'run' and len(args) == 0:
- jhbuild.commands.run(command, config, ['sugar-emulator'])
-else:
- jhbuild.commands.run(command, config, args)
+jhbuild.commands.run(command, config, args)