File: common.py

package info (click to toggle)
gnome-python-extras 2.14.3-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,756 kB
  • ctags: 731
  • sloc: sh: 8,856; ansic: 5,011; xml: 1,319; python: 725; makefile: 415
file content (40 lines) | stat: -rw-r--r-- 885 bytes parent folder | download | duplicates (2)
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
import os
import sys
import warnings

warnings.simplefilter('ignore', DeprecationWarning)
#warnings.simplefilter('ignore', ImportWarning)

modules = [
    "gtkhtml2",
    ("egg.trayicon", "egg/tray"),
    ("egg.recent", "egg/recent"),
    "gtkmozembed",
    "gtkspell",
    "gdl",
    "gda",
    "gksu",
    ("gksu.ui", "gksu"),
    ]

import ltihooks

for item in modules:
    if isinstance(item, tuple):
        module, dirname = item
    else:
        module = item
        dirname = item
    sys.path.insert(0, os.path.join("..", dirname))
    print "Trying to import module %s... " % (module,),
    try:
        __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."

ltihooks.uninstall()