Check for already Slackware binary packages exist
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()
646395
function() {
      var kalaboxYaml = path.join(dest, 'kalabox.yml');
      var pkgJson = path.join(dest, 'package.json');
      return fs.existsSync(kalaboxYaml) && fs.existsSync(pkgJson);
    }
964563
def with_checklist(self):
        
        data = []
        if self.name == "ALL":
            data = self.data
        else:
            for name in self.data:
                if self.name in name:
                    data.append(name)
        if data:
            text = "Press 'spacebar' to choose SlackBuild for view"
            title = " SlackBuilds.org "
            backtitle = "{0} {1}".format(_meta_.__all__, _meta_.__version__)
            status = False
            pkg = DialogUtil(data, text, title, backtitle, status).checklist()
            if pkg and len(pkg) > 1:
                print("\nslpkg: Error: Choose only one package")
                raise SystemExit()
            if pkg is None:
                raise SystemExit()
            self.name = "".join(pkg)
            os.system("clear")
798992
def _pip_exists(self):
        """"""
        return os.path.isfile(os.path.join(self.path, 'bin', 'pip'))
1235374
def slack_ver():
    

    if _meta_.slackware_version in ["off", "OFF"]:
        sv = Utils().read_file("/etc/slackware-version")
        version = re.findall(r"\d+", sv)
        if len(sv) > 2:
            return (".".join(version[:2]))
        else:
            return (".".join(version))
    else:
        return _meta_.slackware_version
1092202
def is_deb_package_installed(pkg):
    

    with settings(hide('warnings', 'running', 'stdout', 'stderr'),
                  warn_only=True, capture=True):

        result = sudo('dpkg-query -l "%s" | grep -q ^.i' % pkg)
        return not bool(result.return_code)
640861
def store(self):
        
        data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
        black = BlackList().packages(pkgs=data[0], repo="slack")
        for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
            status(0.0003)
            repo_pkg_name = split_package(name)[0]
            if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
                    repo_pkg_name not in black and
                    repo_pkg_name not in self.skip):
                self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""),
                                                          loc, name))
                self.comp_sum.append(comp)
                self.uncomp_sum.append(uncomp)
                self.upgrade_all.append(name)
                self.count_upg += 1
                if not find_package(repo_pkg_name + self.meta.sp,
                                    self.meta.pkg_path):
                    self.count_added += 1
                    self.count_upg -= 1
        return self.count_upg
53506
def get_binaries():
    """"""
    paths = []
    for arp in [False, True]:
        paths.append(get_binary(arp=arp))
    return paths
518624
def update(self, *pkgs, **kwargs):
        """"""
        cmd_list = ['update', '--json', '--yes']

        if not pkgs and not kwargs.get('all'):
            raise TypeError("Must specify at least one package to update, or "
                            "all=True.")

        cmd_list.extend(
            self._setup_install_commands_from_kwargs(
                kwargs,
                ('dry_run', 'no_deps', 'override_channels',
                 'no_pin', 'force', 'all', 'use_index_cache', 'use_local',
                 'alt_hint')))

        cmd_list.extend(pkgs)

        return self._call_and_parse(cmd_list, abspath=kwargs.get('abspath',
                                                                 True))
614343
def is_package_installed(self, package_name):
        """"""
        if not package_name:
            raise ValueError('package_name required.')

        installed = True
        try:
            Cmd.sh_e('{0} --query {1} --quiet'.format(self.rpm_path,
                                                      package_name))
        except InstallError:
            installed = False
        return installed
360556
def verify():
    """"""
    verbose = True
    log(
        "Verifying current directory as a Dallinger experiment...",
        delay=0,
        verbose=verbose,
    )
    ok = verify_package(verbose=verbose)
    if ok:
        log("✓ Everything looks good!", delay=0, verbose=verbose)
    else:
        log("☹ Some problems were found.", delay=0, verbose=verbose)
1170453
function checkPkg(pkgDir, scopes) {
  var errors;
  try {
    var config = {packageDir: pkgDir};
    if (scopes) {
      config.scopeList = scopes;
    }
    var checked = checkDeps.sync(config);
    if (checked.error.length) {
      errors = checked.error;
    }
  } finally {
    // eslint-disable-next-line no-unsafe-finally
    return errors;
  }
}
805827
def _check_all_deps(self, pkg_name=None, pkg_file=None, formula_def=None):
        '''
        
        '''
        if pkg_file and not os.path.exists(pkg_file):
            raise SPMInvocationError('Package file {0} not found'.format(pkg_file))

        self.repo_metadata = self._get_repo_metadata()
        if not formula_def:
            for repo in self.repo_metadata:
                if not isinstance(self.repo_metadata[repo]['packages'], dict):
                    continue
                if pkg_name in self.repo_metadata[repo]['packages']:
                    formula_def = self.repo_metadata[repo]['packages'][pkg_name]['info']

        if not formula_def:
            raise SPMInvocationError('Unable to read formula for {0}'.format(pkg_name))

        # Check to see if the package is already installed
        pkg_info = self._pkgdb_fun('info', pkg_name, self.db_conn)
        pkgs_to_install = []
        if pkg_info is None or self.opts['force']:
            pkgs_to_install.append(pkg_name)
        elif pkg_info is not None and not self.opts['force']:
            raise SPMPackageError(
                'Package {0} already installed, not installing again'.format(formula_def['name'])
            )

        optional_install = []
        recommended_install = []
        if 'dependencies' in formula_def or 'optional' in formula_def or 'recommended' in formula_def:
            self.avail_pkgs = {}
            for repo in self.repo_metadata:
                if not isinstance(self.repo_metadata[repo]['packages'], dict):
                    continue
                for pkg in self.repo_metadata[repo]['packages']:
                    self.avail_pkgs[pkg] = repo

            needs, unavail, optional, recommended = self._resolve_deps(formula_def)

            if unavail:
                raise SPMPackageError(
                    'Cannot install {0}, the following dependencies are needed:\n\n{1}'.format(
                        formula_def['name'], '\n'.join(unavail))
                )

            if optional:
                optional_install.extend(optional)
                for dep_pkg in optional:
                    pkg_info = self._pkgdb_fun('info', formula_def['name'])
                    msg = dep_pkg
                    if isinstance(pkg_info, dict):
                        msg = '{0} [Installed]'.format(dep_pkg)
                    optional_install.append(msg)

            if recommended:
                recommended_install.extend(recommended)
                for dep_pkg in recommended:
                    pkg_info = self._pkgdb_fun('info', formula_def['name'])
                    msg = dep_pkg
                    if isinstance(pkg_info, dict):
                        msg = '{0} [Installed]'.format(dep_pkg)
                    recommended_install.append(msg)

            if needs:
                pkgs_to_install.extend(needs)
                for dep_pkg in needs:
                    pkg_info = self._pkgdb_fun('info', formula_def['name'])
                    msg = dep_pkg
                    if isinstance(pkg_info, dict):
                        msg = '{0} [Installed]'.format(dep_pkg)

        return pkgs_to_install, optional_install, recommended_install
1031122
def exists(package):
    
    pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
    cmd = '{0} --exists {1}'.format(pkg_config_exe, package).split()
    return call(cmd) == 0
1044659
def check_deps(deps):
        """"""
        if not isinstance(deps, list):
            deps = [deps]
        checks = list(Environment.has_apps(deps))
        if not all(checks):
            for name, available in list(dict(zip(deps, checks)).items()):
                if not available:
                    error_msg = "The required application/dependency '{0}'" \
                                " isn't available.".format(name)
                    raise SystemError(error_msg)
188900
def _check_if_used(self, removes):
        """"""
        if "--check-deps" in self.extra:
            package, dependency, pkg_dep = [], [], []
            for pkg in find_package("", self.dep_path):
                deps = Utils().read_file(self.dep_path + pkg)
                for rmv in removes:
                    if GetFromInstalled(rmv).name() and rmv in deps.split():
                        pkg_dep.append(
                            "{0} is dependency of the package --> {1}".format(
                                rmv, pkg))
                        package.append(pkg)
                        dependency.append(rmv)
            if package:
                if "--checklist" in self.extra:
                    text = ("Press 'spacebar' to choose packages for the remove"
                            " exception")
                    backtitle = "{0} {1}".format(self.meta.__all__,
                                                 self.meta.__version__)
                    status = False
                    choose = DialogUtil(pkg_dep, text, " !!! WARNING !!! ",
                                        backtitle, status).checklist()
                    for pkg in choose:
                        self.skip.append(pkg.split()[0])
                else:
                    self.msg.template(78)
                    print("| {0}{1}{2}".format(
                        self.meta.color["RED"], " " * 30 + "!!! WARNING !!!",
                        self.meta.color["ENDC"]))
                    self.msg.template(78)
                    for p, d in zip(package, dependency):
                        print("| {0}{1}{2} is dependency of the package --> "
                              "{3}{4}{5}".format(self.meta.color["YELLOW"], d,
                                                 self.meta.color["ENDC"],
                                                 self.meta.color["GREEN"], p,
                                                 self.meta.color["ENDC"]))
                    self.msg.template(78)
                    self._skip_remove()
772044
def precheck():
    
    binaries = ['make']
    for bin in binaries:
        if not which(bin):
            msg = 'Dependency fail -- Unable to locate rquired binary: '
            stdout_message('%s: %s' % (msg, ACCENT + bin + RESET))
            return False
        elif not root():
            return False
    return True