Пример #1
0
	def init(self, root = None):
		if root is not None:
			self.root = root

		# LOG is deprecated
		k = ( 'LOG',   'LOG_DB',   'VCARD',   'AVATAR',   'MY_EMOTS',
			'MY_ICONSETS', 'MY_MOOD_ICONSETS',
			'MY_ACTIVITY_ICONSETS', 'MY_CACERTS')
		v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons',
			u'iconsets',  u'moods', u'activities', u'cacerts.pem')

		if os.name == 'nt':
			v = map(lambda x: x.capitalize(), v)

		for n, p in zip(k, v):
			self.add_from_root(n, p)

		self.add('DATA', os.path.join(u'..', windowsify(u'data')))
		self.add('HOME', fse(os.path.expanduser('~')))
		self.add('TMP', fse(tempfile.gettempdir()))

		try:
			import svn_config
			svn_config.configure(self)
		except (ImportError, AttributeError):
			pass
Пример #2
0
    def init(self, root=None):
        if root is not None:
            self.root = root

        # LOG is deprecated
        k = ('LOG', 'LOG_DB', 'VCARD', 'AVATAR', 'MY_EMOTS', 'MY_ICONSETS',
             'MY_MOOD_ICONSETS', 'MY_ACTIVITY_ICONSETS', 'MY_CACERTS')
        v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons',
             u'iconsets', u'moods', u'activities', u'cacerts.pem')

        if os.name == 'nt':
            v = map(lambda x: x.capitalize(), v)

        for n, p in zip(k, v):
            self.add_from_root(n, p)

        self.add('DATA', os.path.join(u'..', windowsify(u'data')))
        self.add('HOME', fse(os.path.expanduser('~')))
        self.add('TMP', fse(tempfile.gettempdir()))

        try:
            import svn_config
            svn_config.configure(self)
        except (ImportError, AttributeError):
            pass
Пример #3
0
    def init(self, root=None, profile='', profile_separation=False):
        if root is not None:
            self.config_root = self.cache_root = self.data_root = root

        self.init_profile(profile)
        
        if len(profile) > 0 and profile_separation:
            profile = u'.' + profile
        else:
            profile = ''
            
        d = {'LOG_DB': 'logs.db', 'MY_CACERTS': 'cacerts.pem',
            'MY_EMOTS': 'emoticons', 'MY_ICONSETS': 'iconsets',
            'MY_MOOD_ICONSETS': 'moods', 'MY_ACTIVITY_ICONSETS': 'activities',
            'PLUGINS_USER': '******',
            'RNG_SEED': 'rng_seed'}
        for name in d:
            d[name] += profile
            self.add(name, TYPE_DATA, windowsify(d[name]))
        if len(profile):
            self.add('MY_DATA', TYPE_DATA, 'data.dir')
        else:
            self.add('MY_DATA', TYPE_DATA, '')

        d = {'CACHE_DB': 'cache.db', 'VCARD': 'vcards',
                'AVATAR': 'avatars'}
        for name in d:
            d[name] += profile
            self.add(name, TYPE_CACHE, windowsify(d[name]))
        if len(profile):
            self.add('MY_CACHE', TYPE_CACHE, 'cache.dir')
        else:
            self.add('MY_CACHE', TYPE_CACHE, '')

        if len(profile):
            self.add('MY_CONFIG', TYPE_CONFIG, 'config.dir')
        else:
            self.add('MY_CONFIG', TYPE_CONFIG, '')

        basedir = fse(os.environ.get('GAJIM_BASEDIR', defs.basedir))
        self.add('DATA', None, os.path.join(basedir, windowsify('data')))
        self.add('ICONS', None, os.path.join(basedir, windowsify('icons')))
        self.add('HOME', None, fse(os.path.expanduser('~')))
        self.add('PLUGINS_BASE', None, os.path.join(basedir,
            windowsify('plugins')))
        try:
            self.add('TMP', None, fse(tempfile.gettempdir()))
        except IOError as e:
            print('Error opening tmp folder: %s\nUsing %s' % (str(e),
                os.path.expanduser('~')), file=sys.stderr)
            self.add('TMP', None, fse(os.path.expanduser('~')))

        try:
            import svn_config
            svn_config.configure(self)
        except (ImportError, AttributeError):
            pass