Create a package finder appropriate to this list command.
431296
def _build_package_finder(options, index_urls, session):
        
        return PackageFinder(
            find_links=options.get('find_links'),
            index_urls=index_urls,
            allow_all_prereleases=options.get('pre'),
            trusted_hosts=options.get('trusted_hosts'),
            session=session,
        )
623849
function createConfIndex() {
        requireConf.baseUrl = requireConf.baseUrl.replace(/\/$/, '') + '/';

        // create paths index
        pathsIndex = createKVSortedIndex(requireConf.paths);

        // create mappingId index
        mappingIdIndex = createKVSortedIndex(requireConf.map, 1);
        each(
            mappingIdIndex,
            function (item) {
                item.v = createKVSortedIndex(item.v);
            }
        );

        var lastMapItem = mappingIdIndex[mappingIdIndex.length - 1];
        if (lastMapItem && lastMapItem.k === '*') {
            each(
                mappingIdIndex,
                function (item) {
                    if (item != lastMapItem) {
                        item.v = item.v.concat(lastMapItem.v);
                    }
                }
            );
        }

        // create packages index
        packagesIndex = [];
        each(
            requireConf.packages,
            function (packageConf) {
                var pkg = packageConf;
                if (typeof packageConf === 'string') {
                    pkg = {
                        name: packageConf.split('/')[0],
                        location: packageConf,
                        main: 'main'
                    };
                }

                pkg.location = pkg.location || pkg.name;
                pkg.main = (pkg.main || 'main').replace(/\.js$/i, '');
                pkg.reg = createPrefixRegexp(pkg.name);
                packagesIndex.push(pkg);
            }
        );
        packagesIndex.sort(descSorterByKOrName);

        // create urlArgs index
        urlArgsIndex = createKVSortedIndex(requireConf.urlArgs, 1);

        // create bundles index
        bundlesIndex = {};
        /* eslint-disable no-use-before-define */
        function bundlesIterator(id) {
            bundlesIndex[resolvePackageId(id)] = key;
        }
        /* eslint-enable no-use-before-define */
        for (var key in requireConf.bundles) {
            each(requireConf.bundles[key], bundlesIterator);
        }
    }
63675
def fallbackPackage(package_name, fallback_package_name):
    '''
    
    
    '''
    importer = Finder(package_name, fallback_package_name)
    sys.meta_path.append(importer)
54262
def fetch_pkg_list(self):
        """"""
        self.logger.debug("DEBUG: Fetching package name list from PyPI")
        package_list = self.list_packages()
        cPickle.dump(package_list, open(self.pkg_cache_file, "w"))
        self.pkg_list = package_list
357165
def via_find_packages(self):  # type: () -> List[str]
        
        packages = []  # type: List[str]
        source = self.setup_py_source()
        if not source:
            return packages
        find_package_args = ""
        for row in source.split("\n"):
            if "find_packages" in row:
                logger.debug(row)
                if "find_packages()" in row:
                    packages = find_packages()
                else:
                    try:

                        find_package_args_source = row.split("(")[1].split(")")[0]
                        find_package_args = ast.literal_eval(find_package_args_source)
                        logger.debug(packages)
                    except:
                        logger.debug(source)
                        # raise
        if not find_package_args:
            packages = find_packages()
        else:
            try:
                # signature find(cls, where='.', exclude=(), include=('*',)):
                packages = find_packages(find_package_args)
            except:
                packages = find_packages()

        return packages
1272546
public List<String> findPackages() {
    List<String>	result;
    Iterator<String> packages;

    result   = new ArrayList<>();
    packages = m_Cache.packages();
    while (packages.hasNext())
      result.add(packages.next());
    Collections.sort(result, new StringCompare());

    return result;
  }
550662
def list_files(package, conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    data = conn.execute('SELECT package FROM packages WHERE package=?', (package, ))
    if not data.fetchone():
        if close:
            conn.close()
        return None

    ret = []
    data = conn.execute('SELECT path, sum FROM files WHERE package=?', (package, ))
    for file_ in data.fetchall():
        ret.append(file_)
    if close:
        conn.close()

    return ret
714293
def get_package_data(name, extlist):
    """"""
    flist = []
    # Workaround to replace os.path.relpath (not available until Python 2.6):
    offset = len(name)+len(os.pathsep)
    for dirpath, _dirnames, filenames in os.walk(name):
        for fname in filenames:
            if not fname.startswith('.') and osp.splitext(fname)[1] in extlist:
                flist.append(osp.join(dirpath, fname)[offset:])
    return flist
33378
def find_csv_packages(m, downloader):
    """"""
    from metapack.package import CsvPackageBuilder

    pkg_dir = m.package_root
    name = m.doc.get_value('Root.Name')

    package_path, cache_path = CsvPackageBuilder.make_package_path(pkg_dir, name)

    if package_path.exists():
        return open_package(package_path, downloader=downloader)
1123011
function findPackage(dir, packageName) {
    let d = dir || '.';
    do {
        let f = path.join(d, 'package.json');
        if ( fs.existsSync(f) ) {
            // require(f) would look for paths relative to this module,
            // but we need it to be relative to process.cwd()
            if ( !path.isAbsolute(f) ) {
                f = fs.realpathSync(f);
            }
            const p = requireJSON(f);
            // Look for a specific project name
            if ( packageName ) {
                if ( p ) {
                    if ( p.name == packageName ) {
                        return f;
                    }
                }
            }
            // Look for any project except this one (verup)
            else {
                if ( p ) {
                    if ( (p.extra && p.extra.verup || p.verup) && p.name != 'verup' ) {
                        return f;
                    }
                }
            }
        }
        dir = d;
        d = path.join(d, '..');
    } while (d != dir && dir.slice(0,2) != '..');
    return false;
}
1347918
def find(self, package, **kwargs):
        
        if not exists(package):
            return None
        name, path = None, None
        enforce_init = kwargs.pop('enforce_init', True)
        if isdir(package):
            if isfile(join(package, '__init__.py')) or not enforce_init:
                name, path = basename(package), package
        elif isfile(package) and package.endswith('.py'):
            name, path = splitext(basename(package))[0], package
        if name and path:
            return PackageSpec(name, path)
        return None
335980
def find_installed_packages(self):
        
        list_command = subprocess.Popen(self.list_command, shell=True, stdout=subprocess.PIPE)
        stdout, stderr = list_command.communicate()
        if list_command.returncode != 0:
            raise SystemDependencyError("The command to list the installed system packages failed! ({command})",
                                        command=self.list_command)
        installed_packages = sorted(stdout.decode().split())
        logger.debug("Found %i installed system package(s): %s", len(installed_packages), installed_packages)
        return installed_packages
523208
def packages(ciprcfg, env, opts, console):
    
    for name, source in ciprcfg.packages.items():
        console.normal('- %s' % name)

        if opts.long_details:
            console.normal('  - directory: %s' % path.join(env.package_dir, name))
            console.normal('  - source: %s' % source)
1033742
def package_files(directory):
    """"""
    paths = []
    for (path, _, file_names) in walk(directory):
        for filename in file_names:
            paths.append(join('..', path, filename))
    return paths
98265
def hack_find_packages(include_str):
    
    new_list = [include_str]
    for element in find_packages(include_str):
        new_list.append(include_str + '.' + element)

    return new_list
503197
def execute_finder(self, manager, package_name):
        
        filename = '{env_path}/results.json'.format(env_path=manager.env_path)
        subprocess.call([
            manager.venv_python, self._finder_path, package_name, filename
        ])

        # Load results into this context
        json_str = open(filename, 'r').read()
        return json.loads(json_str)
1144748
private void searchSubPackage(String packageName,
                                  ListBuffer<String> packages,
                                  List<String> excludedPackages,
                                  Collection<File> pathnames) {
        if (excludedPackages.contains(packageName))
            return;

        String packageFilename = packageName.replace('.', File.separatorChar);
        boolean addedPackage = false;
        for (File pathname : pathnames) {
            File f = new File(pathname, packageFilename);
            String filenames[] = f.list();
            // if filenames not null, then found directory
            if (filenames != null) {
                for (String filename : filenames) {
                    if (!addedPackage
                            && (isValidJavaSourceFile(filename) ||
                                isValidJavaClassFile(filename))
                            && !packages.contains(packageName)) {
                        packages.append(packageName);
                        addedPackage = true;
                    } else if (isValidClassName(filename) &&
                               (new File(f, filename)).isDirectory()) {
                        searchSubPackage(packageName + "." + filename,
                                         packages, excludedPackages, pathnames);
                    }
                }
            }
        }
    }