Message for matching packages
19346
def matching(self, packages):
        
        print("\nNot found package with the name [ {0}{1}{2} ]. "
              "Matching packages:\nNOTE: Not dependenc"
              "ies are resolved\n".format(self.meta.color["CYAN"],
                                          "".join(packages),
                                          self.meta.color["ENDC"]))
575524
static private boolean hasMatch(String path, List<String> patterns) {
        for (String p : patterns) {
            // Exact match
            if (p.equals(path)) {
                return true;
            }
            // Single dot the end matches this package and all its subpackages.
            if (p.endsWith(".*")) {
                // Remove the wildcard
                String patprefix = p.substring(0,p.length()-2);
                // Does the path start with the pattern prefix?
                if (path.startsWith(patprefix)) {
                    // If the path has the same length as the pattern prefix, then it is a match.
                    // If the path is longer, then make sure that
                    // the next part of the path starts with a dot (.) to prevent
                    // wildcard matching in the middle of a package name.
                    if (path.length()==patprefix.length() || path.charAt(patprefix.length())=='.') {
                        return true;
                    }
                }
            }
        }
        return false;
    }
1148115
def license_contents
      matched_files.reject { |f| f == package_file }
                   .group_by(&:content)
                   .map { |content, files| { "sources" => license_content_sources(files), "text" => content } }
    end
302748
function findPackage(config, match) {
  var map = getPackageMap(config.relativeTo, config.packages);

  return _.reduce(map, function (prev, pkg) {

    // Resolve using last priority. Priority:
    // 1. package is a file
    // 2. package granularity (done by file depth)
    if (pkg.regexp.test(match) && (!prev || (pkg.dir && prev.dir && pkg.depth >= pkg.depth) || pkg.file)) {
      return pkg;
    } else {
      return prev;
    }

  }, null);
}
77548
function findPackages(packagesPath) {
  return fs.readdirSync(packagesPath).reduce((acc, d) => {
    const fullpath = path.resolve(packagesPath, d);

    if (fs.statSync(fullpath).isDirectory()) {
      try {
        fs.statSync(path.resolve(fullpath, 'package.json'));
        acc.push(fullpath);
      }
      catch (err) {
        if (err.code === 'ENOENT') {
          return acc.concat(findPackages(fullpath));
        }
        throw err;
      }
    }

    return acc;
  }, []);
}
1335250
def get():
    """"""
    pkgnames = find_packages()

    if len(pkgnames) == 0:
        raise ValueError("Can't find any packages")

    pkgname = pkgnames[0]

    content = open(join(pkgname, '__init__.py')).read()
    c = re.compile(r"__version__ *= *('[^']+'|\"[^\"]+\")")
    m = c.search(content)

    if m is None:
        raise ValueError("Can't find __version__ = ... in __init__.py")

    return m.groups()[0][1: -1]
416769
def parse_new_packages(apt_output, include_automatic=False):
    
    pat = r'^The following NEW packages will be installed:[\r\n]+(.*?)[\r\n]\w'
    matcher = re.search(pat, apt_output, re.DOTALL | re.MULTILINE)
    if not matcher:
        return []
    new_pkg_text = matcher.group(1)
    raw_names = re.findall(r'[\w{}\.+-]+', new_pkg_text)
    all_packages = list(map(PackageName.from_apt, raw_names))
    manual_packages = [pack for pack in all_packages if not pack.automatic]
    return all_packages if include_automatic else manual_packages
409469
def regex_in_package_file(regex, filename, package_name, return_match=False):
    
    filepath = package_file_path(filename, package_name)
    return regex_in_file(regex, filepath, return_match=return_match)
868623
def check_package(self, package, package_dir):
        """"""
        try:
            return self.packages_checked[package]
        except KeyError:
            pass

        init_py = orig.build_py.check_package(self, package, package_dir)
        self.packages_checked[package] = init_py

        if not init_py or not self.distribution.namespace_packages:
            return init_py

        for pkg in self.distribution.namespace_packages:
            if pkg == package or pkg.startswith(package + '.'):
                break
        else:
            return init_py

        with io.open(init_py, 'rb') as f:
            contents = f.read()
        if b'declare_namespace' not in contents:
            raise distutils.errors.DistutilsError(
                "Namespace package problem: %s is a namespace package, but "
                "its\n__init__.py does not call declare_namespace()! Please "
                'fix it.\n(See the setuptools manual under '
                '"Namespace Packages" for details.)\n"' % (package,)
            )
        return init_py
662732
def is_package(name):
    
    name = name.lower()  # compare package name against lowercase name
    packages = pkg_resources.working_set.by_key.keys()
    for package in packages:
        if package.lower().replace('-', '_') == name:
            return True
    return False
9803
def listed(self):
        
        print("\nPackages in the queue:\n")
        for pkg in self.packages():
            if pkg:
                print("{0}{1}{2}".format(self.meta.color["GREEN"], pkg,
                                         self.meta.color["ENDC"]))
                self.quit = True
        if self.quit:
            print("")
311
function getMessageFromPackage(messageType, type, callback) {
  var packageName = getPackageNameFromMessageType(messageType);
  var messageName = getMessageNameFromMessageType(messageType);
  packages.findPackage(packageName, function(error, directory) {
    var filePath;
    filePath = path.join(directory, type, messageName + '.' + type);
    getMessageFromFile(messageType, filePath, type, callback);
  });
}
271287
def anitya_specific_distro(config, message, distro=None, *args, **kw):
    

    if not distro:
        return False

    if not anitya_catchall(config, message):
        return False

    d = message['msg'].get('distro', {})
    if d:  # Have to be careful for None here
        if d.get('name', '').lower() == distro.lower():
            return True

    d = None
    p = message['msg'].get('project', {})
    if p:
        d = p.get('distro', {})
    if d:  # Have to be careful for None here
        if d.get('name', '').lower() == distro.lower():
            return True

    for pkg in message['msg'].get('message', {}).get('packages', []):
        if pkg['distro'].lower() == distro.lower():
            return True

    return False
1174200
def _software(self, *args, **kwargs):
        '''
        
        '''
        data = dict()
        if 'exclude' in kwargs:
            excludes = kwargs['exclude'].split(",")
        else:
            excludes = list()

        os_family = __grains__.get("os_family").lower()

        # Get locks
        if os_family == 'suse':
            LOCKS = "pkg.list_locks"
            if 'products' not in excludes:
                products = __salt__['pkg.list_products']()
                if products:
                    data['products'] = products
        elif os_family == 'redhat':
            LOCKS = "pkg.get_locked_packages"
        else:
            LOCKS = None

        if LOCKS and 'locks' not in excludes:
            locks = __salt__[LOCKS]()
            if locks:
                data['locks'] = locks

        # Get patterns
        if os_family == 'suse':
            PATTERNS = 'pkg.list_installed_patterns'
        elif os_family == 'redhat':
            PATTERNS = 'pkg.group_list'
        else:
            PATTERNS = None

        if PATTERNS and 'patterns' not in excludes:
            patterns = __salt__[PATTERNS]()
            if patterns:
                data['patterns'] = patterns

        # Get packages
        if 'packages' not in excludes:
            data['packages'] = __salt__['pkg.list_pkgs']()

        # Get repositories
        if 'repositories' not in excludes:
            repos = __salt__['pkg.list_repos']()
            if repos:
                data['repositories'] = repos

        return data
533087
def check_extra_requirements(pkgname, pkgver):
    '''
    
    '''
    keyword = None

    match = re.match('^(~)?([<>])?(=)?([^<>=]*)$', pkgver)
    if match:
        keyword, gt_lt, eq, verstr = match.groups()
        prefix = gt_lt or ''
        prefix += eq or ''
        # We need to delete quotes around use flag list elements
        verstr = verstr.replace("'", "")
        # If no prefix characters were supplied and verstr contains a version, use '='
        if verstr[0] != ':' and verstr[0] != '[':
            prefix = prefix or '='
            atom = '{0}{1}-{2}'.format(prefix, pkgname, verstr)
        else:
            atom = '{0}{1}'.format(pkgname, verstr)
    else:
        return True

    try:
        cpv = _porttree().dbapi.xmatch('bestmatch-visible', atom)
    except portage.exception.InvalidAtom as iae:
        log.error('Unable to find a matching package for %s: (%s)', atom, iae)
        return False

    if cpv == '':
        return False

    try:
        cur_repo, cur_use = _vartree().dbapi.aux_get(cpv, ['repository', 'USE'])
    except KeyError:
        return False

    des_repo = re.match(r'^.+::([^\[]+).*$', atom)
    if des_repo and des_repo.group(1) != cur_repo:
        return False

    des_uses = set(portage.dep.dep_getusedeps(atom))
    cur_use = cur_use.split()
    if [x for x in des_uses.difference(cur_use) if x[0] != '-' or x[1:] in cur_use]:
        return False

    if keyword:
        if not __salt__['portage_config.has_flag']('accept_keywords', atom, '~ARCH'):
            return False

    return True
115731
def is_installed(self, package):
        """"""
        if isinstance(package, tuple):
            package = '=='.join(package)
        if package.endswith('.git'):
            pkg_name = os.path.split(package)[1][:-4]
            return pkg_name in self.installed_package_names or \
                    pkg_name.replace('_', '-') in self.installed_package_names
        pkg_tuple = split_package_name(package)
        if pkg_tuple[1] is not None:
            return pkg_tuple in self.installed_packages
        else:
            return pkg_tuple[0].lower() in self.installed_package_names
218445
def filter_installed_packages(packages):
    """"""
    cache = apt_cache()
    _pkgs = []
    for package in packages:
        try:
            p = cache[package]
            p.current_ver or _pkgs.append(package)
        except KeyError:
            log('Package {} has no installation candidate.'.format(package),
                level='WARNING')
            _pkgs.append(package)
    return _pkgs