Return the global Intake catalog dir for the current environment
358226
def global_data_dir():
    """"""
    prefix = False
    if VIRTUALENV_VAR in os.environ:
        prefix = os.environ[VIRTUALENV_VAR]
    elif CONDA_VAR in os.environ:
        prefix = sys.prefix
    elif which('conda'):
        # conda exists but is not activated
        prefix = conda_prefix()

    if prefix:
        # conda and virtualenv use Linux-style directory pattern
        return make_path_posix(os.path.join(prefix, 'share', 'intake'))
    else:
        return appdirs.site_data_dir(appname='intake', appauthor='intake')
241417
def get_sdk_dir(self):
        """"""
        try:
            return self._sdk_dir
        except AttributeError:
            sdk_dir = self.find_sdk_dir()
            self._sdk_dir = sdk_dir
            return sdk_dir
1287461
def get_desktop_env():
    """"""
    desktop = os.environ.get("XDG_CURRENT_DESKTOP")
    if desktop:
        return desktop

    desktop = os.environ.get("DESKTOP_SESSION")
    if desktop:
        return desktop

    desktop = os.environ.get("GNOME_DESKTOP_SESSION_ID")
    if desktop:
        return "GNOME"

    desktop = os.environ.get("MATE_DESKTOP_SESSION_ID")
    if desktop:
        return "MATE"

    desktop = os.environ.get("SWAYSOCK")
    if desktop:
        return "SWAY"

    desktop = os.environ.get("DESKTOP_STARTUP_ID")
    if desktop and "awesome" in desktop:
        return "AWESOME"

    return None
713799
function getAppsDataDir(){
	switch(process.platform){
		case 'win32': return process.env.LOCALAPPDATA;
		case 'linux': return process.env.HOME + '/.config';
		case 'darwin': return process.env.HOME + '/Library/Application Support';
		default: throw Error("unknown platform "+process.platform);
	}
}
576879
def _get_dir_list(load):
    '''
    
    '''
    if 'env' in load:
        # "env" is not supported; Use "saltenv".
        load.pop('env')

    if 'saltenv' not in load or load['saltenv'] not in envs():
        return []
    ret = set()
    for repo in init():
        repo['repo'].open()
        ref = _get_ref(repo, load['saltenv'])
        if ref:
            manifest = repo['repo'].manifest(rev=ref[1])
            for tup in manifest:
                filepath = tup[4]
                split = filepath.rsplit('/', 1)
                while len(split) > 1:
                    relpath = os.path.relpath(split[0], repo['root'])
                    # Don't add '.'
                    if relpath != '.':
                        # Don't add files outside the hgfs_root
                        if not relpath.startswith('../'):
                            ret.add(os.path.join(repo['mountpoint'], relpath))
                    split = split[0].rsplit('/', 1)
        repo['repo'].close()
    if repo['mountpoint']:
        ret.add(repo['mountpoint'])
    return sorted(ret)
1046949
def dir_list(self, saltenv='base', prefix=''):
        '''
        
        '''
        load = {'saltenv': saltenv,
                'prefix': prefix,
                'cmd': '_dir_list'}
        return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \
            else self.channel.send(load)
545753
def lib_dir(self):
        """"""
        if not self._lib_dir:
            lib_files = glob.glob("/usr/lib/*/librpm.so*")
            if not lib_files:
                raise InstallError("Can not find lib directory.")
            self._lib_dir = os.path.dirname(lib_files[0])
        return self._lib_dir
1053422
def data_dir(default='data'):
    
    if 'OPENSHIFT_DATA_DIR' in os.environ:
        return os.environ['OPENSHIFT_DATA_DIR']
    if 'GONDOR_DATA_DIR' in os.environ:
        return os.environ['GONDOR_DATA_DIR']
    if provider.detect() == provider.DOTCLOUD:
        return os.path.expanduser('~/data')
    return default
38268
def system_config_dir():
    
    """
    if LINUX or SUNOS:
        path = '/etc'
    elif BSD or MACOS:
        path = '/usr/local/etc'
    else:
        path = os.environ.get('APPDATA')
    if path is None:
        path = ''
    else:
        path = os.path.join(path, 'glances')

    return path
909132
def environment(**options):
    
    env = Environment(**options)
    env.globals.update({
        'static': staticfiles_storage.url,
        'url': reverse,
    })
    env.globals.update(context_processors.environment())
    return env
899467
def env(self, current_scope):
    
    return self.__env_cache.get(
            current_scope.ident,
            framework.Environment, current_scope,
            names=self.keys(),
            parent=framework.Environment({'self': current_scope}, parent=self.__parent_env))
603699
def get(cls, key, default=None, separator='.', global_=False):
        
        # first check environnment variables
        # if we're not in global scope
        if not global_:
            ret = os.environ.get(key.upper().replace('.', '_'))
            if ret is not None:
                return ret

        # then check in local and global configuration unless global_=True
        scopes = ['global'] if global_ else ['local', 'global']
        for scope in scopes:
            ret = cls._get(scope, key, default, separator)
            if ret is not None and ret != default:
                return ret

        if ret is None or ret == default:
            return default
1194110
def get_data_dir():
    """"""
    base_odl_dir = os.environ.get('ODL_HOME', expanduser(join('~', '.odl')))
    data_home = join(base_odl_dir, 'datasets')
    if not exists(data_home):
        os.makedirs(data_home)
    return data_home
682916
def get_ugali_dir():
    """"""

    dirname = os.getenv('UGALIDIR')

    # Get the HOME directory
    if not dirname:
        dirname=os.path.join(os.getenv('HOME'),'.ugali')

    if not os.path.exists(dirname):
        from ugali.utils.logger import logger
        msg = "Creating UGALIDIR:\n%s"%dirname
        logger.warning(msg)

    return mkdir(dirname)
1313201
def get_global_dist_packages_dir():
    
    import utool as ut
    if not ut.in_virtual_env():
        # Non venv case
        return get_site_packages_dir()
    else:
        candidates = []
        if ut.LINUX:
            import sys
            candidates += [
                '/usr/lib/python%s/dist-packages' % (sys.version[0:3],),
                '/usr/lib/python%s/dist-packages' % (sys.version[0:1],),
            ]
        else:
            raise NotImplementedError()
        for path in candidates:
            if ut.checkpath(path):
                return path
289965
def dir():
        
        dir = [
            'access', 'chdir', 'chmod', 'chown', 'close', 'fstat', 'fsync',
            'getcwd', 'lchmod', 'link', 'listdir', 'lstat', 'makedirs',
            'mkdir', 'mknod', 'open', 'read', 'readlink', 'remove',
            'removedirs', 'rename', 'rmdir', 'stat', 'symlink', 'umask',
            'unlink', 'utime', 'walk', 'write'
        ]
        if IS_PY2:
            dir += ['getcwdu']
        else:
            dir += ['getcwdb', 'replace']
            if sys.platform.startswith('linux'):
                dir += [
                    'fdatasync', 'getxattr', 'listxattr',
                    'removexattr', 'setxattr'
                ]
        if use_scandir:
            dir += ['scandir']
        return dir
140763
def get_env_path(cls):
        
        return os.path.dirname(Finder.python()) + os.pathsep + os.environ['PATH']