Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sjhbuild/config.py
blob: e451f93446126e6b9448ea57efb04a6bd2c920bc (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import os
import sys

import jhbuild.config
import distutils.sysconfig

import sysdeps


class Config(jhbuild.config.Config):

    def __init__(self, base_dir, rc_file):
        self.base_dir = base_dir
        jhbuild.config.Config.__init__(self, rc_file)
        self._setup()

    def _setup(self):
        # pylint: disable-msg=W0201
        self.autogenargs = ''

        self.checkoutroot = os.path.join(self.base_dir, 'source')
        self.tarballdir = os.path.join(self.base_dir, 'source')

        deps = sysdeps.get_packages()
        if not deps:
            sys.stderr.write('ERROR: Dependencies information is missing '
                '(unknown distribution/version).\n')
            sys.exit(126)

        for package_, source in deps:
            # pylint: disable-msg=E1101
            if source and source not in self.skip:
                self.skip.append(source)

    def setup_env(self):
        # Hack to replace the default prefix
        if self.prefix == '/opt/gnome':
            self.prefix = os.path.join(self.base_dir, 'install')

        #Hack to allow sugar-jhbuild to find its self again.

        MY_PATH = os.getenv('PATH', 'Error')
        os.environ["PATH"] = MY_PATH + ':' + self.base_dir

        jhbuild.config.Config.setup_env(self)

        jhbuild.config.addpath('XDG_DATA_DIRS', '/usr/share')
        jhbuild.config.addpath('XDG_DATA_DIRS',
            os.path.join(self.prefix, 'share'))

        jhbuild.config.addpath('GTK_PATH',
            os.path.join(self.prefix, ['lib', 'lib64'][self.use_lib64],
                'gtk-2.0', ''))
        jhbuild.config.addpath('GTK_DATA_PREFIX', self.prefix)

        os.environ['SUGAR_PREFIX'] = self.prefix
        os.environ['SUGAR_PATH'] = os.path.join(self.prefix, 'share', 'sugar')
        os.environ['SUGAR_LOCALEDIR'] = os.path.join(self.prefix, 'share', 'locale')
        os.environ.setdefault('SUGAR_LOGGER_LEVEL', 'debug')

        # Enable debug log of the Telepathy components
        os.environ.setdefault('GABBLE_DEBUG', 'all')
        os.environ.setdefault('SALUT_DEBUG', 'all')
        os.environ.setdefault('MC_DEBUG', 'all')
        os.environ.setdefault('STREAM_ENGINE_DEBUG', 'all')

        # We need to add the gtk-2.0 directory explicitly to
        # the Python path since '.pth' files (here pygtk.pth)
        # only work properly in system directories
        pythonlib = distutils.sysconfig.get_python_lib(prefix='')
        pythonpath_basic = pythonlib.split('/', 1)[1]
        jhbuild.config.addpath('PYTHONPATH',
            os.path.join(self.prefix, 'lib', pythonpath_basic, 'gtk-2.0'))
        jhbuild.config.addpath('PYTHONPATH',
            os.path.join(self.prefix, 'lib64', pythonpath_basic, 'gtk-2.0'))

        # workaround for bug in jhbuild
        # note: even for use_lib64 we need "lib" here as that's where
        # distutils installs to
        pythonpath_lib = os.path.join(self.prefix, 'lib', pythonpath_basic)
        jhbuild.config.addpath('PYTHONPATH', pythonpath_lib)

        os.environ['PYTHON_LIB'] = distutils.sysconfig.get_python_lib(
            prefix=self.prefix)

        os.environ['PYLINTRC'] = os.path.join(self.base_dir, 'scripts',
            'data', 'pylintrc')

        if 'DBUS_SESSION_BUS_ADDRESS' in os.environ:
            del os.environ['DBUS_SESSION_BUS_ADDRESS']

        if not 'SUGAR_PROFILE' in os.environ:
            os.environ['SUGAR_PROFILE'] = 'default'