Print message when package not found
348525
def pkg_not_found(self, bol, pkg, message, eol):
        
        print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
144588
def package_in_pypi(package):
    """"""
    url = 'http://pypi.python.org/simple/%s' % package
    try:
        urllib.request.urlopen(url)
        return True
    except urllib.error.HTTPError as e:
        logger.debug("Package not found on pypi: %s", e)
        return False
797750
def error(*args):
    """"""
    if sys.stdin.isatty():
        print('ERROR:', *args, file=sys.stderr)
    else:
        notify_error(*args)
344667
def proper_case(package_name):
    """"""
    # Hit the simple API.
    r = _get_requests_session().get(
        "https://pypi.org/pypi/{0}/json".format(package_name), timeout=0.3, stream=True
    )
    if not r.ok:
        raise IOError(
            "Unable to find package {0} in PyPI repository.".format(package_name)
        )

    r = parse.parse("https://pypi.org/pypi/{name}/json", r.url)
    good_name = r["name"]
    return good_name
676008
def _list_packages(self, args):
        '''
        
        '''
        packages = self._pkgdb_fun('list_packages', self.db_conn)
        for package in packages:
            if self.opts['verbose']:
                status_msg = ','.join(package)
            else:
                status_msg = package[0]
            self.ui.status(status_msg)
90048
def find(self, pkg, flag):
        
        print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
            self.cyan, ", ".join(pkg), self.endc))
        Msg().template(78)
        print("| {0}  {1}{2}{3}".format("Repository", "Package", " " * 54,
                                        "Size"))
        Msg().template(78)
        for repo in _meta_.repositories:
            PACKAGES_TXT = PackageManager(pkg).list_lib(repo)
            packages, sizes = PackageManager(pkg).list_greps(repo, PACKAGES_TXT)
            for find, size in zip(packages, sizes):
                for p in pkg:
                    if "--case-ins" in flag:
                        self.p_cache = p.lower()
                        self.find_cache = find.lower()
                    else:
                        self.p_cache = p
                        self.find_cache = find
                    if self.p_cache in self.find_cache:
                        if self.cache != repo:
                            self.count_repo += 1
                        self.cache = repo
                        self.count_pkg += 1
                        ver = self.sbo_version(repo, find)
                        print("  {0}{1}{2}{3}{4} {5}{6:>11}".format(
                            self.cyan, repo, self.endc,
                            " " * (12 - len(repo)),
                            find + ver, " " * (53 - len(find + ver)),
                            size))
        print("\nFound summary")
        print("=" * 79)
        print("{0}Total found {1} packages in {2} repositories."
              "{3}\n".format(self.grey, self.count_pkg,
                             self.count_repo, self.endc))
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
43991
def _get_package_status(package):
    """"""
    status = package["status_str"] or "Unknown"
    stage = package["stage_str"] or "Unknown"
    if stage == "Fully Synchronised":
        return status
    return "%(status)s / %(stage)s" % {"status": status, "stage": stage}
541414
def output_package(dist):
        """"""
        if dist_is_editable(dist):
            return '%s (%s, %s)' % (
                dist.project_name,
                dist.version,
                dist.location,
            )
        return '%s (%s)' % (dist.project_name, dist.version)
247844
def wait_for_package_sync(
    ctx, opts, owner, repo, slug, wait_interval, skip_errors, attempts=3
):
    """"""
    # pylint: disable=too-many-locals
    attempts -= 1
    click.echo()
    label = "Synchronising %(package)s:" % {"package": click.style(slug, fg="green")}

    status_str = "Waiting"
    stage_str = None

    def display_status(current):
        """Display current sync status."""
        # pylint: disable=unused-argument
        if not stage_str:
            return status_str
        return click.style(
            "%(status)s / %(stage)s" % {"status": status_str, "stage": stage_str},
            fg="cyan",
        )

    context_msg = "Failed to synchronise file!"
    with handle_api_exceptions(
        ctx, opts=opts, context_msg=context_msg, reraise_on_error=skip_errors
    ):
        last_progress = 0
        with click.progressbar(
            length=100,
            label=label,
            fill_char=click.style("#", fg="green"),
            empty_char=click.style("-", fg="red"),
            item_show_func=display_status,
        ) as pb:
            while True:
                res = get_package_status(owner, repo, slug)
                ok, failed, progress, status_str, stage_str, reason = res
                delta = progress - last_progress
                if delta > 0:
                    last_progress = progress
                    pb.update(delta)
                if ok or failed:
                    break
                time.sleep(wait_interval)

    if ok:
        click.secho("Package synchronised successfully!", fg="green")
        return

    click.secho(
        "Package failed to synchronise during stage: %(stage)s"
        % {"stage": click.style(stage_str or "Unknown", fg="yellow")},
        fg="red",
    )

    if reason:
        click.secho(
            "Reason given: %(reason)s" % {"reason": click.style(reason, fg="yellow")},
            fg="red",
        )

        # pylint: disable=fixme
        # FIXME: The API should communicate "no retry" fails
        if "package should be deleted" in reason and attempts > 1:
            click.secho(
                "This is not recoverable, so stopping further attempts!", fg="red"
            )
            click.echo()
            attempts = 0

    if attempts + 1 > 0:
        # Show attempts upto and including zero attempts left
        click.secho(
            "Attempts left: %(left)s (%(action)s)"
            % {
                "left": click.style(six.text_type(attempts), bold=True),
                "action": "trying again" if attempts > 0 else "giving up",
            }
        )
        click.echo()

    if attempts > 0:
        from .resync import resync_package

        resync_package(
            ctx=ctx,
            opts=opts,
            owner=owner,
            repo=repo,
            slug=slug,
            skip_errors=skip_errors,
        )

        wait_for_package_sync(
            ctx=ctx,
            opts=opts,
            owner=owner,
            repo=repo,
            slug=slug,
            wait_interval=wait_interval,
            skip_errors=skip_errors,
            attempts=attempts,
        )
    else:
        ctx.exit(1)
419230
def _get_missing_results(results, dest_dir):
    '''
    
    '''
    try:
        present = set(os.listdir(dest_dir))
    except OSError as exc:
        if exc.errno == errno.ENOENT:
            log.debug('pkgbuild.built: dest_dir \'%s\' does not exist', dest_dir)
        elif exc.errno == errno.EACCES:
            log.error('pkgbuilt.built: cannot access dest_dir \'%s\'', dest_dir)
        present = set()
    return sorted(set(results).difference(present))
1149700
def error(self, message):
        """"""
        sys.stderr.write('error: %s\n\n' % message)
        self.print_help()
        sys.exit(2)
197490
def auto_detect(self, args):
        
        suffixes = [
            ".tgz",
            ".txz",
            ".tbz",
            ".tlz"
        ]
        if (not args[0].startswith("-") and args[0] not in self.commands and
                args[0].endswith(tuple(suffixes))):
            packages, not_found = [], []
            for pkg in args:
                if pkg.endswith(tuple(suffixes)):
                    if os.path.isfile(pkg):
                        packages.append(pkg)
                    else:
                        not_found.append(pkg)
            if packages:
                Auto(packages).select()
            if not_found:
                for ntf in not_found:
                    self.msg.pkg_not_found("", ntf, "Not installed", "")
            raise SystemExit()
105381
def pkg_available(pkg_name,required=False):
    ''''''
    if pkg_name in pkgs:
        return True
    if required:
        nl.notify('Error: could not find required analysis package %s' % pkg_name,level=nl.level.error)
    return False
884289
function printPackageFormatError() {
  console.log(
    `${
      C.errorText
    } Please specify the package to install with peerDeps in the form of \`package\` or \`package@n.n.n\``
  );
  console.log(
    `${
      C.errorText
    } At this time you must provide the full semver version of the package.`
  );
  console.log(
    `${
      C.errorText
    } Alternatively, omit it to automatically install the latest version of the package.`
  );
}
559813
def package_ensure_apt(*packages):
    """"""
    package = " ".join(packages)
    status = run("dpkg-query -W -f='${{Status}} ' {p}; true".format(p=package))
    status = status.lower()
    if 'no packages found' in status or 'not-installed' in status:
        sudo("apt-get --yes install " + package)
        return False
    else:
        return True
1204698
def check_description(package_info, *args):
    
    reason = "Description missing"
    result = False

    if package_info.get('description') not in BAD_VALUES:
        result = True

    return result, reason, HAS_DESCRIPTION