File: common.py

package info (click to toggle)
gnome-python-desktop 2.32.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,528 kB
  • ctags: 983
  • sloc: sh: 10,214; xml: 8,851; ansic: 3,428; python: 1,457; makefile: 664
file content (53 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download | duplicates (3)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
import sys
import gobject
gobject.threads_init()


modules = [
    "gnomeapplet",
    "gnomeprint",
    ("ui", "gnomeprint"),
    "gtksourceview",
    "wnck",
    ("plparser", "totem"),
    "gtop",
    "nautilusburn",
    "mediaprofiles",
    "metacity",
    "rsvg",
    "gnomekeyring",
    "gnomedesktop",
    ("ebook", "evolution"),
    ("ecal", "evolution"),
    "evince",
    "braseromedia",
    "braseroburn",
    ]

def run_import_tests(builddir, no_import_hooks):
    if not no_import_hooks:
        import ltihooks
        ltihooks.install()

    for item in modules:
        if isinstance(item, tuple):
            module, dirname = item
        else:
            module = item
            dirname = item
        sys.path.insert(0, os.path.join(builddir, dirname))
        print "Trying to import module %s... " % (module,),
        try:
            mod = __import__(module) # try to import the module to catch undefined symbols
        except ImportError, ex:
            if ex.args[0].startswith("No module named"):
                print "not found"
            else:
                raise
        else:
            print "ok."
            globals()[module] = mod

    if not no_import_hooks:
        ltihooks.uninstall()