Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sjhbuild/depscheck.py
blob: 74c37e46c9e1ca12ec674c48325c0926249c1d26 (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, help=None):
        deps = sysdeps.get_packages()
        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)
        elif not options.script:
            print 'All dependencies are installed.'


register_command(cmd_depscheck)