Пример #1
0
    def __init__(self, filename, conditions_modifiers):
        self._config = {
            '__file__': _defaults_file,
            'prependpath':  prependpath,
            'include': self.include,
            }

        if not self._orig_environ:
            self.__dict__['_orig_environ'] = os.environ.copy()
        os.environ['UNMANGLED_PATH'] = os.environ.get('PATH', '')

        env_prepends.clear()
        try:
            exec(compile(open(_defaults_file, "rb").read(), _defaults_file, 'exec'), self._config)
        except:
            traceback.print_exc()
            raise FatalError('could not load config defaults')

        config_file = os.path.expanduser('~/icbuild/icbuildrc')

        if filename:
            if not os.path.exists(filename):
                raise FatalError('could not load config file, %s is missing' % filename)
        else:
            if os.path.exists(config_file):
                filename = config_file

        if filename:
            self._config['__file__'] = filename
            self.filename = filename
        else:
            self._config['__file__'] = config_file
            self.filename = config_file

        # we might need to redo this process on config reloads, so save these
        self.saved_conditions_modifiers = conditions_modifiers

        self._config['conditions'] = conditions_modifiers
        self.load(filename)
        modify_conditions(self.conditions, conditions_modifiers)

        self.create_directories()

        setup_env(self)

        self.update_build_targets()
Пример #2
0
    def __init__(self, filename, conditions_modifiers):
        self._config = {
            '__file__': _defaults_file,
            'addpath': addpath,
            'prependpath': prependpath,
            'include': self.include,
        }

        if not self._orig_environ:
            self.__dict__['_orig_environ'] = os.environ.copy()
        os.environ['UNMANGLED_LD_LIBRARY_PATH'] = os.environ.get(
            'LD_LIBRARY_PATH', '')
        os.environ['UNMANGLED_PATH'] = os.environ.get('PATH', '')

        env_prepends.clear()
        try:
            execfile(_defaults_file, self._config)
        except Exception:
            traceback.print_exc()
            raise FatalError(_('could not load config defaults'))

        old_config = os.path.join(os.path.expanduser('~'), '.jhbuildrc')
        new_config = os.path.join(
            os.environ.get('XDG_CONFIG_HOME',
                           os.path.join(os.path.expanduser('~'), '.config')),
            'jhbuildrc')

        if filename:
            if not os.path.exists(filename):
                raise FatalError(
                    _('could not load config file, %s is missing') % filename)
        else:
            if os.path.isfile(old_config) \
                    and not os.path.islink(old_config) \
                    and os.path.isfile(new_config) \
                    and not os.path.islink(new_config):
                raise FatalError(_('The default location of the configuration '
                                   'file has changed. Please move %(old_path)s'
                                   ' to %(new_path)s.' \
                                   % {'old_path': old_config,
                                      'new_path': new_config}))
            if os.path.exists(new_config):
                filename = new_config
            elif os.path.exists(old_config):
                filename = old_config

        if filename:
            self._config['__file__'] = filename
            self.filename = filename
        else:
            self._config['__file__'] = new_config
            self.filename = new_config

        # we might need to redo this process on config reloads, so save these
        self.saved_conditions_modifiers = conditions_modifiers

        # We handle the conditions flags like so:
        #   - get the default set of conditions (determined by the OS)
        #   - modify it with the commandline arguments
        #   - load the config file so that it can make further modifications
        #   - modify it with the commandline arguments again
        #
        # We apply the commandline argument condition modifiers both before
        # and after parsing the configuration so that the jhbuildrc has a
        # chance to inspect the modified set of flags (and conditionally act
        # on it to set new autogenargs, for example) but also so that the
        # condition flags given on the commandline will ultimately override
        # those in jhbuildrc.
        self._config['conditions'] = sysid.get_default_conditions()
        modify_conditions(self._config['conditions'], conditions_modifiers)
        self.load(filename)
        modify_conditions(self.conditions, conditions_modifiers)
        self.ignore_conditions = False

        self.create_directories()

        setup_env_defaults(self.system_libdirs)

        for prefix in reversed(self.extra_prefixes):
            setup_env(prefix)
        setup_env(self.prefix)

        self.apply_env_prepends()
        self.update_build_targets()
Пример #3
0
 def real_setup_env(self):
     from jhbuild.environment import setup_env
     setup_env(self.prefix)
Пример #4
0
    def __init__(self, filename, conditions_modifiers):
        self._config = {
            '__file__': _defaults_file,
            'addpath':  addpath,
            'prependpath':  prependpath,
            'include': self.include,
            }

        if not self._orig_environ:
            self.__dict__['_orig_environ'] = os.environ.copy()
        os.environ['UNMANGLED_LD_LIBRARY_PATH'] = os.environ.get('LD_LIBRARY_PATH', '')
        os.environ['UNMANGLED_PATH'] = os.environ.get('PATH', '')

        env_prepends.clear()
        try:
            execfile(_defaults_file, self._config)
        except:
            traceback.print_exc()
            raise FatalError(_('could not load config defaults'))

        old_config = os.path.join(os.path.expanduser('~'), '.jhbuildrc')
        new_config = os.path.join \
                         (os.environ.get \
                             ('XDG_CONFIG_HOME',
                              os.path.join(os.path.expanduser('~'), '.config')),
                          'jhbuildrc')

        if filename:
            if not os.path.exists(filename):
                raise FatalError(_('could not load config file, %s is missing') % filename)
        else:
            if os.path.isfile(old_config) \
                and not os.path.islink(old_config) \
                and os.path.isfile(new_config) \
                and not os.path.islink(new_config):
                raise FatalError(_('The default location of the configuration '
                                   'file has changed. Please move %(old_path)s'
                                   ' to %(new_path)s.' \
                                   % {'old_path': old_config,
                                      'new_path': new_config}))
            if os.path.exists(new_config):
                filename = new_config
            elif os.path.exists(old_config):
                filename = old_config

        if filename:
            self._config['__file__'] = filename
            self.filename = filename
        else:
            self._config['__file__'] = new_config
            self.filename = new_config

        # we might need to redo this process on config reloads, so save these
        self.saved_conditions_modifiers = conditions_modifiers

        # We handle the conditions flags like so:
        #   - get the default set of conditions (determined by the OS)
        #   - modify it with the commandline arguments
        #   - load the config file so that it can make further modifications
        #   - modify it with the commandline arguments again
        #
        # We apply the commandline argument condition modifiers both before
        # and after parsing the configuration so that the jhbuildrc has a
        # chance to inspect the modified set of flags (and conditionally act
        # on it to set new autogenargs, for example) but also so that the
        # condition flags given on the commandline will ultimately override
        # those in jhbuildrc.
        self._config['conditions'] = sysid.get_default_conditions()
        modify_conditions(self._config['conditions'], conditions_modifiers)
        self.load(filename)
        modify_conditions(self.conditions, conditions_modifiers)

        self.create_directories()

        setup_env_defaults(self.system_libdirs)

        for prefix in reversed(self.extra_prefixes):
            setup_env(prefix)
        setup_env(self.prefix)

        self.apply_env_prepends()
        self.update_build_targets()
Пример #5
0
    def real_setup_env(self):
        from jhbuild.environment import setup_env

        setup_env(self.prefix)