Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sjhbuild/depscheck.py
blob: f55f19ec7be5435e9eb6707f2cb74ec10f5e92fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
from optparse import make_option

from jhbuild.commands import Command, register_command

import sysdeps

class cmd_depscheck(Command):

    name = 'depscheck'
    doc = 'Check that all system dependencies are installed'
    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)