diff options
-rw-r--r-- | build-scripts/olpc.jhbuildrc | 24 | ||||
-rw-r--r-- | dependencychecker.py | 30 | ||||
-rw-r--r-- | sanitycheck.py | 48 | ||||
-rwxr-xr-x | sugar-jhbuild | 17 |
4 files changed, 51 insertions, 68 deletions
diff --git a/build-scripts/olpc.jhbuildrc b/build-scripts/olpc.jhbuildrc deleted file mode 100644 index 1097c4b..0000000 --- a/build-scripts/olpc.jhbuildrc +++ /dev/null @@ -1,24 +0,0 @@ -import traceback - -base_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) -scripts_dir = os.path.join(base_dir, 'build-scripts') - -prefix = os.path.join(base_dir, 'build') -checkoutroot = os.path.join(base_dir, 'source') - -moduleset = [] -moduleset.append(os.path.join(scripts_dir, 'sugar-base.modules')) -moduleset.append(os.path.join(scripts_dir, 'sugar-framework.modules')) -moduleset.append(os.path.join(scripts_dir, 'sugar-activities.modules')) -moduleset.append(os.path.join(scripts_dir, 'sugar-extras.modules')) - -modules = [ 'meta-sugar' ] - -module_autogenargs['dbus'] = '--with-system-socket=/var/run/dbus/system_bus_socket' - -user_config = os.path.expanduser('~/.olpc.jhbuildrc') -if os.path.isfile(user_config): - try: - execfile(user_config) - except: - traceback.print_exc() diff --git a/dependencychecker.py b/dependencychecker.py deleted file mode 100644 index e892831..0000000 --- a/dependencychecker.py +++ /dev/null @@ -1,30 +0,0 @@ -import os -import re - -def _check_module(self, module): - pid = os.fork() - if not pid: - os.execvp('pkg-config', [ 'pkg-config', '--exists', module ]) - return os.wait()[1] == 0 - -def _check_command_output(command, regexp): - f = os.popen(command) - output = f.read() - f.close() - - return re.compile(regexp).search(output) - -class DependencyChecker: - def __init__(self): - self._missing = [] - - def check_python(self, version): - if not _check_command_output('python -V', version): - self._missing.append('python %s' % version) - - def check_library(self, name): - if not _check_module(name): - self._missing.append(name) - - def get_missing(self): - return self._missing diff --git a/sanitycheck.py b/sanitycheck.py new file mode 100644 index 0000000..274e2d0 --- /dev/null +++ b/sanitycheck.py @@ -0,0 +1,48 @@ +import os +import re + +from jhbuild.commands import Command, register_command + +def _check_module(self, module): + pid = os.fork() + if not pid: + os.execvp('pkg-config', [ 'pkg-config', '--exists', module ]) + return os.wait()[1] == 0 + +def _check_command_output(command, regexp): + f = os.popen(command) + output = f.read() + f.close() + + return re.compile(regexp).search(output) + +class DependencyChecker: + def __init__(self): + self._missing = [] + + def check_python(self, version): + if not _check_command_output('python -V', version): + self._missing.append('python %s' % version) + + def check_library(self, name): + if not _check_module(name): + self._missing.append(name) + + def get_missing(self): + return self._missing + +class cmd_sanitycheck(Command): + + name = 'sanitycheck' + usage_args = '' + + def run(self, config, options, args): + checker = DependencyChecker() + checker.check_python('2.5') + + if len(checker.get_missing()) > 0: + print 'Missing dependencies:' + for missing in checker.get_missing(): + print missing + +register_command(cmd_sanitycheck) diff --git a/sugar-jhbuild b/sugar-jhbuild index 4eb5223..6c3135c 100755 --- a/sugar-jhbuild +++ b/sugar-jhbuild @@ -9,18 +9,10 @@ sys.path.append(os.path.join(base_dir, 'build-scripts', 'jhbuild')) import jhbuild.commands import bundlemodule +import sanitycheck + from config import Config from updater import Updater -from dependencychecker import DependencyChecker - -def cmd_sanitycheck(): - checker = DependencyChecker() - checker.check_python('2.5') - - print 'Missing dependencies:' - if len(checker.get_missing()) > 0: - for missing in checker.get_missing(): - print missing updater = Updater(base_dir) updater.update() @@ -36,7 +28,4 @@ if len(sys.argv) > 0: if len(sys.argv) > 1: args = sys.argv[2:] -if command == 'sanitycheck': - cmd_sanitycheck() -else: - jhbuild.commands.run(command, config, args) +jhbuild.commands.run(command, config, args) |