Find nni lib from the following locations in order
    Return nni root directory if it exists
347207
def get_nni_installation_path():
    ''' 
    '''
    def try_installation_path_sequentially(*sitepackages):
        '''Try different installation path sequentially util nni is found.
        Return None if nothing is found
        '''
        def _generate_installation_path(sitepackages_path):
            python_dir = get_python_dir(sitepackages_path)
            entry_file = os.path.join(python_dir, 'nni', 'main.js')
            if os.path.isfile(entry_file):
                return python_dir
            return None

        for sitepackage in sitepackages:
            python_dir = _generate_installation_path(sitepackage)
            if python_dir:
                return python_dir
        return None

    if os.getenv('VIRTUAL_ENV'):
        # if 'virtualenv' package is used, `site` has not attr getsitepackages, so we will instead use VIRTUAL_ENV
        # Note that conda venv will not have VIRTUAL_ENV
        python_dir = os.getenv('VIRTUAL_ENV')
    else:
        python_sitepackage = site.getsitepackages()[0]
        # If system-wide python is used, we will give priority to using `local sitepackage`--"usersitepackages()" given that nni exists there
        if python_sitepackage.startswith('/usr') or python_sitepackage.startswith('/Library'):
            python_dir = try_installation_path_sequentially(site.getusersitepackages(), site.getsitepackages()[0])
        else:
            python_dir = try_installation_path_sequentially(site.getsitepackages()[0], site.getusersitepackages())

    if python_dir:
        entry_file = os.path.join(python_dir, 'nni', 'main.js')
        if os.path.isfile(entry_file):
            return os.path.join(python_dir, 'nni')
    print_error('Fail to find nni under python library')
    exit(1)
1333313
def library_directories(self):
        """"""

        libs = self.find_products('library')

        if len(libs) > 0:
            return [os.path.join(self.output_folder)]

        return []
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)
488802
def get_root_dir(self):
        
        if os.path.isdir(self.root_path):
            return self.root_path
        else:
            return os.path.dirname(self.root_path)
726112
def subdir_findall(dir, subdir):
    
    strip_n = len(dir.split('/'))
    path = '/'.join((dir, subdir))
    return ['/'.join(s.split('/')[strip_n:]) for s in setuptools.findall(path)]
288755
def _host_libc(self):
    """"""
    libc_dir_option = self.get_options().libc_dir
    if libc_dir_option:
      maybe_libc_crti = os.path.join(libc_dir_option, self._LIBC_INIT_OBJECT_FILE)
      if os.path.isfile(maybe_libc_crti):
        return HostLibcDev(crti_object=maybe_libc_crti,
                           fingerprint=hash_file(maybe_libc_crti))
      raise self.HostLibcDevResolutionError(
        "Could not locate {} in directory {} provided by the --libc-dir option."
        .format(self._LIBC_INIT_OBJECT_FILE, libc_dir_option))

    return self._get_host_libc_from_host_compiler()
821332
def get_static_lib_paths():
    
    libs = []
    is_linux = sys.platform.startswith('linux')
    if is_linux:
        libs += ['-Wl,--start-group']
    libs += get_raw_static_lib_path()
    if is_linux:
        libs += ['-Wl,--end-group']
    return libs
1179330
def get_inc(self, native=False):
        
        if self.sdk_version == 'v7.0A':
            include = os.path.join(self.sdk_dir, 'include')
            if os.path.isdir(include):
                logging.info(_('using include: %s'), include)
                return [include]
            logging.debug(_('include not found: %s'), include)
            return []
        if self.sdk_version == 'v8.1':
            dirs = []
            if native:
                parts = ['km', os.path.join('km', 'crt'), 'shared']
            else:
                parts = ['um', 'winrt', 'shared']
            for part in parts:
                include = os.path.join(self.sdk_dir, 'include', part)
                if os.path.isdir(include):
                    logging.info(_('using include: %s'), include)
                    dirs.append(include)
                else:
                    logging.debug(_('inc not found: %s'), include)
            return dirs
        if self.sdk_version == 'v10.0':
            dirs = []
            extra = os.path.join('include', '10.0.10240.0')
            for mode in ['um', 'ucrt', 'shared', 'winrt']:
                include = os.path.join(self.sdk_dir, extra, mode)
                if os.path.isdir(include):
                    logging.info(_('using include: %s'), include)
                    dirs.append(include)
                else:
                    logging.debug(_('inc not found: %s'), include)
            return dirs
        message = 'unknown sdk version: {}'.format(self.sdk_version)
        raise RuntimeError(message)
1345306
def findLibrary(name):
    
    assert is_unix, "Current implementation for Unix only (Linux, Solaris, AIX)"

    lib = None

    # Look in the LD_LIBRARY_PATH
    lp = compat.getenv('LD_LIBRARY_PATH', '')
    for path in lp.split(os.pathsep):
        libs = glob(os.path.join(path, name + '*'))
        if libs:
            lib = libs[0]
            break

    # Look in /etc/ld.so.cache
    if lib is None:
        expr = r'/[^\(\)\s]*%s\.[^\(\)\s]*' % re.escape(name)
        m = re.search(expr, compat.exec_command('/sbin/ldconfig', '-p'))
        if m:
            lib = m.group(0)

    # Look in the known safe paths
    if lib is None:
        paths = ['/lib', '/usr/lib']
        if is_aix:
            paths.append('/opt/freeware/lib')
        for path in paths:
            libs = glob(os.path.join(path, name + '*'))
            if libs:
                lib = libs[0]
                break

    # give up :(
    if lib is None:
        return None

    # Resolve the file name into the soname
    dir, file = os.path.split(lib)
    return os.path.join(dir, getSoname(lib))
1230144
def find_lib_path():
    
    if os.environ.get('LIGHTGBM_BUILD_DOC', False):
        # we don't need lib_lightgbm while building docs
        return []

    curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
    dll_path = [curr_path,
                os.path.join(curr_path, '../../'),
                os.path.join(curr_path, 'compile'),
                os.path.join(curr_path, '../compile'),
                os.path.join(curr_path, '../../lib/')]
    if system() in ('Windows', 'Microsoft'):
        dll_path.append(os.path.join(curr_path, '../compile/Release/'))
        dll_path.append(os.path.join(curr_path, '../compile/windows/x64/DLL/'))
        dll_path.append(os.path.join(curr_path, '../../Release/'))
        dll_path.append(os.path.join(curr_path, '../../windows/x64/DLL/'))
        dll_path = [os.path.join(p, 'lib_lightgbm.dll') for p in dll_path]
    else:
        dll_path = [os.path.join(p, 'lib_lightgbm.so') for p in dll_path]
    lib_path = [p for p in dll_path if os.path.exists(p) and os.path.isfile(p)]
    if not lib_path:
        dll_path = [os.path.realpath(p) for p in dll_path]
        raise Exception('Cannot find lightgbm library file in following paths:\n' + '\n'.join(dll_path))
    return lib_path
1133957
def get_lib(self, arch='x86'):
        
        if arch == 'x86':
            arch = ''
        if arch == 'x64':
            arch = 'amd64'
        lib = os.path.join(self.vc_dir, 'lib', arch)
        if os.path.isdir(lib):
            logging.info(_('using lib: %s'), lib)
            return [lib]
        logging.debug(_('lib not found: %s'), lib)
        return []
105959
def GetFileList(rootPaths, lstXtn, shortNameOnly='Y'):
    
    numFiles = 0    
    opFileList = []
    if type(rootPaths) == str:
        rootPaths = [rootPaths]
    for rootPath in rootPaths:
        for root, dirs, files in os.walk(rootPath):
            #print('found ' + str(len(dirs)) + ' directories')
            for basename in files:
                for xtn in lstXtn:
                    if fnmatch.fnmatch(basename, xtn):
                        filename = os.path.join(root, basename)
                        numFiles = numFiles + 1
                        if shortNameOnly == 'Y':
                            opFileList.append( os.path.basename(filename))
                        else:
                            opFileList.append(filename)
                        
    return sorted(opFileList)
604280
def find_packages(root_directory: str = '.') -> t.List[str]:
    """"""
    exclude = ['test*', 'test.*'] if ('bdist_wheel' in sys.argv or 'bdist' in sys.argv) else []
    packages_list = setuptools.find_packages(root_directory, exclude=exclude)
    return packages_list
222656
def env(mounts):
    
    f_mounts = [m.strip("/") for m in mounts]

    root = local.path("/")

    ld_libs = [root / m / "lib" for m in f_mounts]
    ld_libs.extend([root / m / "lib64" for m in f_mounts])

    paths = [root / m / "bin" for m in f_mounts]
    paths.extend([root / m / "sbin" for m in f_mounts])
    paths.extend([root / m for m in f_mounts])
    return paths, ld_libs
1038095
def getIncludeDirectories(self, engineRoot, delimiter=' '):
		
		return delimiter.join(self.resolveRoot(self.includeDirs, engineRoot))
1035090
function getSourceDirectories() {
	var dirs = [ 'lib', 'src', 'app' ],
		result = [];

	dirs.forEach(function(dir) {
		if (test('-d', dir)) {
			result.push(dir);
		}
	});

	return result;
}
1008194
def NetFxSDKLibraries(self):
        
        if self.vc_ver < 14.0 or not self.si.NetFxSdkDir:
            return []

        arch_subdir = self.pi.target_dir(x64=True)
        return [os.path.join(self.si.NetFxSdkDir, r'lib\um%s' % arch_subdir)]