make sure that all the dependencies have been installed.
186017
function resolveDependencies (pkg, cb) {
  if (!pkg) return topCb(new Error(
    "Package not found to resolve dependencies"))
  // link foo-1.0.3 to ROOT/.npm/{pkg}/{version}/node_modules/foo

  // see if it's bundled already
  var bundleDir = path.join( npm.dir, pkg.name, pkg.version
                           , "package", "node_modules" )
   , deps = pkg.dependencies && Object.keys(pkg.dependencies) || []
  log.verbose([pkg, deps], "deps being resolved")
  fs.readdir(bundleDir, function (er, bundledDeps) {
    if (er) bundledDeps = []
    bundledDeps.forEach(function (bd) {
      var i = deps.indexOf(bd)
      if (i !== -1) deps.splice(i, 1)
    })

    asyncMap(deps, function (i, cb) {
      var req = { name:i, version:pkg.dependencies[i] }
      log.verbose(req.name+"@"+req.version, "required")

      // see if we have this thing installed.
      fs.readdir(path.join(npm.dir, req.name), function (er, versions) {
        if (er) return cb(new Error(
          "Required package: "+req.name+"("+req.version+") not found."+
          "\n(required by: "+pkg._id+")"))
        // TODO: Get the "stable" version if there is one.
        // Look that up from the registry.
        var satis = semver.maxSatisfying(versions, req.version)
        if (satis) return cb(null, {name:req.name, version:satis})
        return cb(new Error(
          "Required package: "+req.name+"("+req.version+") not found. "+
          "(Found: "+JSON.stringify(versions)+")"+
          "\n(required by: "+pkg._id+")"))
      })
    }, function (er, found) {
      // save the resolved dependencies on the pkg data for later
      pkg._resolvedDeps = found
      cb(er, found)
    })
  })
}
49833
def verify_valid_dependencies(self):
        

        unobserved_dependencies = set(self.tasks.keys())
        target_queue = []

        while len(unobserved_dependencies) > 0:
            target_queue = [unobserved_dependencies.pop()]

            while target_queue is not []:
                target_queue += unobserved_dependencies
864393
def install_tools(dependencies):
    
    tools = getattr(easy.options, "tools", {})
    for dependency in iterutil.flatten(dependencies):
        dependency = tools.get(dependency, dependency)
        try:
            pkg_resources.require(dependency)
        except pkg_resources.DistributionNotFound:
            vsh("pip", "install", "-q", dependency)
            dependency = pkg_resources.require(dependency)
            easy.info("Installed required tool %s" % (dependency,))
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
918
def load_installed_plugins():
        """"""
        providers = {}
        checkers = {}
        for entry_point in pkg_resources.iter_entry_points(group='archan'):
            obj = entry_point.load()
            if issubclass(obj, Provider):
                providers[entry_point.name] = obj
            elif issubclass(obj, Checker):
                checkers[entry_point.name] = obj
        return collections.namedtuple(
            'Plugins', 'providers checkers')(
                providers=providers,
                checkers=checkers)
522351
def check_dependencies():
    
    available = []
    try:
        shell('ebook-convert')
        available.append('calibre')
    except OSError:
        pass
    try:
        shell('pandoc --help')
        available.append('pandoc')
    except OSError:
        pass
    if not available:
        sys.exit(error('No generator found, you cannot use md2ebook.'))
    check_dependency_epubcheck()
    return available
1041495
def missing_dependencies():
    """"""
    missing_deps = []
    for dependency in DEPENDENCIES:
        if not dependency.check() and not dependency.optional:
            missing_deps.append(dependency)
    if missing_deps:
        return status(deps=missing_deps, linesep='<br>')
    else:
        return ""
211400
def verify_package_status(self):
        """"""
        # rpm-libs is required for /usr/lib64/librpm*.so
        self.rpm.verify_packages_installed(['rpm-libs'])

        # Check RPM so files to build the Python binding.
        message_format = '''
RPM: {0} or
RPM download tool (dnf-plugins-core (dnf) or yum-utils (yum)) required.
Install any of those.
'''
        if self.rpm.has_composed_rpm_bulid_libs():
            if (not self.rpm.is_package_installed('rpm-build-libs')
               and not self.rpm.is_downloadable()):
                raise InstallError(message_format.format('rpm-build-libs'))
        else:
            # All the needed so files are included in rpm-libs package.
            pass
1196870
function canInitialize(dependencies, initialized) {
  return !dependencies || 
    dependencies.length === 0 || 
    dependencies.every(function (name) {
      return !!initialized[name];
    });
}
369454
function validateDependencies(configDir) {
  const packageJsonPath = path.join(findup.sync(configDir, 'package.json'), 'package.json');
  const packageJson = require(packageJsonPath);
  DEPENDENCIES.forEach(validateDependency.bind(null, packageJson));
}
819864
def main(path_dir, requirements_name):
    """"""
    click.echo("\nWARNING: Uninstall libs it's at your own risk!")
    click.echo('\nREMINDER: After uninstall libs, update your requirements '
               'file.\nUse the `pip freeze > requirements.txt` command.')

    click.echo('\n\nList of installed libs and your dependencies added on '
               'project\nrequirements that are not being used:\n')

    check(path_dir, requirements_name)
1088224
def upgrade_all(self):
        
        for pkg in self.installed_package_names:
            self.install(pkg, upgrade=True)
1217179
def dependencies(self, name=None, prefix=None, pkgs=None, channels=None,
                     dep=True):
        """"""
        if not pkgs or not isinstance(pkgs, (list, tuple)):
            raise TypeError('must specify a list of one or more packages to '
                            'install into existing environment')

        cmd_list = ['install', '--dry-run', '--json', '--force-pscheck']

        if not dep:
            cmd_list.extend(['--no-deps'])

        if name:
            cmd_list.extend(['--name', name])
        elif prefix:
            cmd_list.extend(['--prefix', prefix])
        else:
            pass

        cmd_list.extend(pkgs)

        # TODO: Check if correct
        if channels:
            cmd_list.extend(['--override-channels'])

            for channel in channels:
                cmd_list.extend(['--channel'])
                cmd_list.extend([channel])

        return self._call_and_parse(cmd_list)
494415
def ensure_packages(packages):
    """"""
    required = filter_installed_packages(packages)
    if required:
        apt_install(required, fatal=True)
134953
def get_dependencies(self):
    """"""
    producer_infos = set()
    for product_type in self._dependencies:
      producer_infos.update(self._get_producer_infos_by_product_type(product_type))
    return producer_infos
738177
def check(projects):
    """"""
    log = logging.getLogger('ciu')
    log.info('{0} top-level projects to check'.format(len(projects)))
    print('Finding and checking dependencies ...')
    blockers = dependencies.blockers(projects)

    print('')
    for line in message(blockers):
        print(line)

    print('')
    for line in pprint_blockers(blockers):
        print(' ', line)

    return len(blockers) == 0
632419
def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
        """"""
        unnamed = list(self.unnamed_requirements)
        reqs = list(self.requirements.values())
        while reqs or unnamed:
            if unnamed:
                req_to_install = unnamed.pop(0)
            else:
                req_to_install = reqs.pop(0)
            req_version = None
            install = True
            best_installed = False
            if not self.ignore_installed and not req_to_install.editable:
                req_to_install.check_if_exists()
                if req_to_install.satisfied_by:
                    if self.upgrade:
                        if not self.force_reinstall:
                            try:
                                url, req_version = finder.find_requirement(
                                    req_to_install, self.upgrade)
                            except BestVersionAlreadyInstalled:
                                best_installed = True
                                install = False
                            else:
                                # Avoid the need to call find_requirement again
                                req_to_install.url = url.url

                        if not best_installed:
                            req_to_install.conflicts_with = req_to_install.satisfied_by
                            req_to_install.satisfied_by = None
                    else:
                        install = False
                if req_to_install.satisfied_by:
                    if best_installed:
                        logger.notify('Requirement already up-to-date: %s'
                                      % req_to_install)
                    else:
                        logger.notify('Requirement already satisfied '
                                      '(use --upgrade to upgrade): %s'
                                      % req_to_install)
            if req_to_install.editable:
                logger.notify('Obtaining %s' % req_to_install)
            elif install:
                if req_to_install.url and req_to_install.url.lower().startswith('file:'):
                    logger.notify('Unpacking %s' % display_path(url_to_path(req_to_install.url)))
                else:
                    logger.notify('Downloading/unpacking %s' % req_to_install)
            logger.indent += 2
            try:
                is_bundle = False
                if req_to_install.editable:
                    if req_to_install.source_dir is None:
                        location = req_to_install.build_location(self.src_dir)
                        req_to_install.source_dir = location
                    else:
                        location = req_to_install.source_dir
                    if not os.path.exists(self.build_dir):
                        _make_build_dir(self.build_dir)
                    req_to_install.update_editable(not self.is_download)
                    if self.is_download:
                        req_to_install.run_egg_info()
                        req_to_install.archive(self.download_dir)
                    else:
                        req_to_install.run_egg_info()
                elif install:
                    ##@@ if filesystem packages are not marked
                    ##editable in a req, a non deterministic error
                    ##occurs when the script attempts to unpack the
                    ##build directory

                    location = req_to_install.build_location(self.build_dir, not self.is_download)
                    ## FIXME: is the existance of the checkout good enough to use it?  I don't think so.
                    unpack = True
                    if not os.path.exists(os.path.join(location, 'setup.py')):
                        ## FIXME: this won't upgrade when there's an existing package unpacked in `location`
                        if req_to_install.url is None:
                            url, req_version = finder.find_requirement(req_to_install, upgrade=self.upgrade)
                        else:
                            ## FIXME: should req_to_install.url already be a link?
                            url = Link(req_to_install.url)
                            assert url
                        if url:
                            try:
                                self.unpack_url(req_to_install, req_version, url, location, self.is_download)
                            except HTTPError:
                                e = sys.exc_info()[1]
                                logger.fatal('Could not install requirement %s because of error %s'
                                             % (req_to_install, e))
                                raise InstallationError(
                                    'Could not install requirement %s because of HTTP error %s for URL %s'
                                    % (req_to_install, e, url))
                        else:
                            unpack = False
                    if unpack:
                        is_bundle = req_to_install.is_bundle
                        url = None
                        if is_bundle:
                            req_to_install.move_bundle_files(self.build_dir, self.src_dir)
                            for subreq in req_to_install.bundle_requirements():
                                reqs.append(subreq)
                                self.add_requirement(subreq)
                        elif self.is_download:
                            req_to_install.source_dir = location
                            if url and url.scheme in vcs.all_schemes:
                                req_to_install.run_egg_info()
                                req_to_install.archive(self.download_dir)
                        else:
                            req_to_install.source_dir = location
                            req_to_install.run_egg_info()
                            if force_root_egg_info:
                                # We need to run this to make sure that the .egg-info/
                                # directory is created for packing in the bundle
                                req_to_install.run_egg_info(force_root_egg_info=True)
                            req_to_install.assert_source_matches_version()
                            #@@ sketchy way of identifying packages not grabbed from an index
                            if bundle and req_to_install.url:
                                self.copy_to_build_dir(req_to_install)
                                install = False
                        # req_to_install.req is only avail after unpack for URL pkgs
                        # repeat check_if_exists to uninstall-on-upgrade (#14)
                        req_to_install.check_if_exists()
                        if req_to_install.satisfied_by:
                            if self.upgrade or self.ignore_installed:
                                req_to_install.conflicts_with = req_to_install.satisfied_by
                                req_to_install.satisfied_by = None
                            else:
                                install = False
                if not is_bundle and not self.is_download:
                    ## FIXME: shouldn't be globally added:
                    finder.add_dependency_links(req_to_install.dependency_links)
                    if (req_to_install.extras):
                        logger.notify("Installing extra requirements: %r" % ','.join(req_to_install.extras))
                    if not self.ignore_dependencies:
                        for req in req_to_install.requirements(req_to_install.extras):
                            try:
                                name = pkg_resources.Requirement.parse(req).project_name
                            except ValueError:
                                e = sys.exc_info()[1]
                                ## FIXME: proper warning
                                logger.error('Invalid requirement: %r (%s) in requirement %s' % (req, e, req_to_install))
                                continue
                            if self.has_requirement(name):
                                ## FIXME: check for conflict
                                continue
                            subreq = InstallRequirement(req, req_to_install)
                            reqs.append(subreq)
                            self.add_requirement(subreq)
                    if req_to_install.name not in self.requirements:
                        self.requirements[req_to_install.name] = req_to_install
                else:
                    self.reqs_to_cleanup.append(req_to_install)
                if install:
                    self.successfully_downloaded.append(req_to_install)
                    if bundle and (req_to_install.url and req_to_install.url.startswith('file:///')):
                        self.copy_to_build_dir(req_to_install)
            finally:
                logger.indent -= 2