diff options
Diffstat (limited to 'scripts/config.py')
-rw-r--r-- | scripts/config.py | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/scripts/config.py b/scripts/config.py new file mode 100644 index 0000000..7c67c80 --- /dev/null +++ b/scripts/config.py @@ -0,0 +1,81 @@ +import os +import sys + +import jhbuild.config + +import sysdeps + +class Config(jhbuild.config.Config): + def __init__(self, rc_file): + scripts_dir = os.path.dirname(__file__) + self._base_dir = os.path.dirname(scripts_dir) + + jhbuild.config.Config.__init__(self, self._ensure_rc_file(rc_file)) + + self._setup() + + def _ensure_rc_file(self, rc_file): + if not os.path.exists(rc_file): + f = open(rc_file, 'w') + f.write('# Created by sugar-jhbuild') + f.close + return rc_file + + def _setup(self): + self.autogenargs = '' + + self.moduleset = [] + self._add_moduleset('platform.modules') + self._add_moduleset('activities.modules') + self._add_moduleset('extra.modules') + self._add_moduleset('extra-activities.modules') + + self.modules = [ 'meta-sugar-platform', + 'meta-sugar-activities' ] + + self.checkoutroot = os.path.join(self._base_dir, 'source') + self.tarballdir = self.checkoutroot + + for package, source in sysdeps.get_packages(): + if source and source not in self.skip: + self.skip.append(source) + + def _add_moduleset(self, moduleset): + set_path = os.path.join(self._base_dir, 'config', + 'modulesets', moduleset) + self.moduleset.append(set_path) + + def setup_env(self): + self.prefix = os.path.join(self._base_dir, 'install') + + jhbuild.config.Config.setup_env(self) + + jhbuild.config.addpath('XDG_DATA_DIRS', '/usr/share') + jhbuild.config.addpath('XDG_DATA_DIRS', os.path.join(self.prefix, 'share')) + + if self.use_lib64: + path = 'lib64/gtk-2.0/' + else: + path = 'lib/gtk-2.0/' + jhbuild.config.addpath('GTK_PATH', os.path.join(self.prefix, path)) + jhbuild.config.addpath('GTK_DATA_PREFIX', self.prefix) + + os.environ['SUGAR_PREFIX'] = self.prefix + os.environ['SUGAR_PATH'] = os.path.join(self.prefix, 'share', 'sugar') + os.environ['SUGAR_LOGGER_LEVEL'] = 'debug' + + # We need to add the gtk-2.0 directory explicitly to + # the Python path since '.pth' files (here pygtk.pth) + # only work properly in system directories + pythonversion = 'python' + str(sys.version_info[0]) + '.' + \ + str(sys.version_info[1]) + if self.use_lib64: + pythonpath = os.path.join(self.prefix, 'lib64', pythonversion, + 'site-packages', 'gtk-2.0') + else: + pythonpath = os.path.join(self.prefix, 'lib', pythonversion, + 'site-packages', 'gtk-2.0') + jhbuild.config.addpath('PYTHONPATH', pythonpath) + + python_lib = os.path.join(self.prefix, 'lib', 'python2.5', 'site-packages') + os.environ['PYTHON_LIB'] = python_lib |