diff options
Diffstat (limited to 'sjhbuild/depscheck.py')
-rw-r--r-- | sjhbuild/depscheck.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sjhbuild/depscheck.py b/sjhbuild/depscheck.py new file mode 100644 index 0000000..f318404 --- /dev/null +++ b/sjhbuild/depscheck.py @@ -0,0 +1,37 @@ +import sys +from optparse import make_option + +from jhbuild.commands import Command, register_command + +import sysdeps + +class cmd_depscheck(Command): + + name = 'depscheck' + usage_args = '' + + def __init__(self): + Command.__init__(self, [ + make_option('-s', '--script', + action='store_true', dest='script', default=False, + help=_('script friendly output')), + ]) + + def run(self, config, options, args): + deps = sysdeps.get_packages() + if not options.script and not deps: + print 'Dependencies information is missing, skip sanity check.' + return + + missing_deps = [] + for package, source in deps: + if not sysdeps.check_package(package): + missing_deps.append(package) + + if missing_deps: + if not options.script: + print 'Missing packages:' + print ' '.join(missing_deps) + sys.exit(1) + +register_command(cmd_depscheck) |