~doko/python/pkg2.5u

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
# FOR DEBIAN, sys.path is augmented with directories in /usr/local.
# Local addons go into /usr/local/lib/python<version>/site-packages
# (resp. /usr/local/lib/site-python), Debian addons install into
# /usr/lib/python<version>/site-packages.

import os, sys

local_site_python = '/usr/local/lib/site-python'
local_site_packages = '/usr/local/lib/@PVER@/site-packages'

try:
    idx = sys.path.index('/usr/lib/@PVER@/site-packages')
    if os.path.isdir(local_site_python):
        sys.path.insert(idx, local_site_python)
    if os.path.isdir(local_site_packages):
        sys.path.insert(idx, local_site_packages)
except ValueError:
    if os.path.isdir(local_site_python):
        sys.path.append(local_site_python)
    if os.path.isdir(local_site_packages):
        sys.path.append(local_site_packages)

# install the apport exception handler if available
try:
    import apport_python_hook
except ImportError:
    pass
else:
    apport_python_hook.install()