Get the dependencies for a project.
421249
def dependencies(project_name):
    """"""
    log = logging.getLogger('ciu')
    log.info('Locating dependencies for {}'.format(project_name))
    located = distlib.locators.locate(project_name, prereleases=True)
    if not located:
        log.warning('{0} not found'.format(project_name))
        return None
    return {packaging.utils.canonicalize_name(pypi.just_name(dep))
            for dep in located.run_requires}
1291825
def find_known_dependencies(self, requirement):
        
        logger.info("Checking for known dependencies of %s ..", requirement.name)
        known_dependencies = sorted(self.dependencies.get(requirement.name.lower(), []))
        if known_dependencies:
            logger.info("Found %s: %s", pluralize(len(known_dependencies), "known dependency", "known dependencies"),
                        concatenate(known_dependencies))
        else:
            logger.info("No known dependencies... Maybe you have a suggestion?")
        return known_dependencies
409420
def get_service_dependencies_for(service):
    

    dependants = get_calculation_dependants_for(service)
    dependencies = get_calculation_dependencies_for(service)

    return {
        "dependencies": dependencies.values(),
        "dependants": dependants.values(),
    }
1182451
def show_dependencies(self):
        """"""
        from spyder.widgets.dependencies import DependenciesDialog
        dlg = DependenciesDialog(self)
        dlg.set_data(dependencies.DEPENDENCIES)
        dlg.exec_()
531776
public List<Dependency> getDependencies(List<String> scopes) {
        log.debug( "Valid scopes: {}", scopes );
        List<Dependency> dependencies = new ArrayList<Dependency>();

        for (Dependency dependency : getMavenModel().getDependencies()) {

            // Substitute Properties
            // XXX: There has to be a way maven handles this automatically
            log.debug( "Project properties: {} ", this.mavenModel.getProperties() );
            String artifactId = substituteProperty(dependency.getArtifactId());
            String groupId    = substituteProperty(dependency.getGroupId());
            String version    = substituteProperty(dependency.getVersion());
            String type       = substituteProperty(dependency.getType());
            String classifier = substituteProperty(dependency.getClassifier());
            String systemPath = substituteProperty(dependency.getSystemPath());

            dependency.setSystemPath(systemPath);
            dependency.setArtifactId(artifactId);
            dependency.setGroupId(groupId);
            dependency.setVersion(version);
            dependency.setType(type);
            dependency.setClassifier( classifier );

            dependencies.add(dependency);
        }


        if ( scopes == null ) {
            scopes = Arrays.asList( "compile", "runtime" );
        }

        for ( Iterator<Dependency> iterator = dependencies.iterator(); iterator.hasNext(); ) {
            Dependency dependency = iterator.next();

            String scope = dependency.getScope();

            // Default scope for dependencies is compile
            if ( scope == null ) {
                scope = "compile";
            }

            if ( !scopes.contains( scope ) ) {
                log.debug( "Removing {} with scope {}", dependency, dependency.getScope() );
                iterator.remove();
            }
        }

        return dependencies;
    }
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 ""
629069
def dependencies(self, task, params={}, **options): 
        
        path = "/tasks/%s/dependencies" % (task)
        return self.client.get(path, params, **options)
660173
def _GetDeps(self, dependencies):
    

    for dependency in dependencies:
      dep_desc = self.FindFileByName(dependency)
      yield dep_desc
      for parent_dep in dep_desc.dependencies:
        yield parent_dep
631022
def get_deps(self):
        
        if self.repo == "rlw":
            dependencies = {}
            rlw_deps = Utils().read_file(_meta_.conf_path + "rlworkman.deps")
            for line in rlw_deps.splitlines():
                if line and not line.startswith("#"):
                    pkgs = line.split(":")
                    dependencies[pkgs[0]] = pkgs[1]
            if self.name in dependencies.keys():
                return dependencies[self.name].split()
            else:
                return ""
        else:
            PACKAGES_TXT = Utils().read_file("{0}{1}_repo/PACKAGES.TXT".format(
                _meta_.lib_path, self.repo))
            for line in PACKAGES_TXT.splitlines():
                if line.startswith("PACKAGE NAME:"):
                    pkg_name = split_package(line[14:].strip())[0]
                if line.startswith("PACKAGE REQUIRED:"):
                    if pkg_name == self.name:
                        if line[18:].strip():
                            return self._req_fix(line)
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
373344
def get_dependencies():
    """"""

    dependencies = []

    # Numpy
    dep_attrs = {
        "name": "numpy",
        "min_version": "1.1.0",
        "description": "required",
    }
    try:
        import numpy
        dep_attrs["version"] = numpy.version.version
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # wxPython
    dep_attrs = {
        "name": "wxPython",
        "min_version": "2.8.10.1",
        "description": "required",
    }
    try:
        import wx
        dep_attrs["version"] = wx.version()
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # Matplotlib
    dep_attrs = {
        "name": "matplotlib",
        "min_version": "1.1.1",
        "description": "required",
    }
    try:
        import matplotlib
        dep_attrs["version"] = matplotlib._version.get_versions()["version"]
    except ImportError:
        dep_attrs["version"] = None
    except AttributeError:
        # May happen in old matplotlib versions
        dep_attrs["version"] = matplotlib.__version__

    dependencies.append(dep_attrs)

    # Pycairo
    dep_attrs = {
        "name": "pycairo",
        "min_version": "1.8.8",
        "description": "required",
    }
    try:
        import cairo
        dep_attrs["version"] = cairo.version
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # Python GnuPG
    dep_attrs = {
        "name": "python-gnupg",
        "min_version": "0.3.0",
        "description": "for opening own files without approval",
    }
    try:
        import gnupg
        dep_attrs["version"] = gnupg.__version__
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # xlrd
    dep_attrs = {
        "name": "xlrd",
        "min_version": "0.9.2",
        "description": "for loading Excel files",
    }
    try:
        import xlrd
        dep_attrs["version"] = xlrd.__VERSION__
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # xlwt
    dep_attrs = {
        "name": "xlwt",
        "min_version": "0.7.2",
        "description": "for saving Excel files",
    }
    try:
        import xlwt
        dep_attrs["version"] = xlwt.__VERSION__
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # Jedi
    dep_attrs = {
        "name": "jedi",
        "min_version": "0.8.0",
        "description": "for tab completion and context help in the entry line",
    }
    try:
        import jedi
        dep_attrs["version"] = jedi.__version__
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # pyrsvg
    dep_attrs = {
        "name": "pyrsvg",
        "min_version": "2.32",
        "description": "for displaying SVG files in cells",
    }
    try:
        import rsvg
        dep_attrs["version"] = True
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    # pyenchant
    dep_attrs = {
        "name": "pyenchant",
        "min_version": "1.6.6",
        "description": "for spell checking",
    }
    try:
        import enchant
        dep_attrs["version"] = enchant.__version__
    except ImportError:
        dep_attrs["version"] = None
    dependencies.append(dep_attrs)

    return dependencies
1004069
def _build_dependencies(self):
        
        for module in list(self.values()):
            module.set_all_dependencies(find_dependencies([module.name], self))
775256
def install_dependencies(dependencies, verbose=False):
    """"""
    if not dependencies:
        return

    stdout = stderr = None if verbose else subprocess.DEVNULL
    with tempfile.TemporaryDirectory() as req_dir:
        req_file = Path(req_dir) / "requirements.txt"

        with open(req_file, "w") as f:
            for dependency in dependencies:
                f.write(f"{dependency}\n")

        pip = ["python3", "-m", "pip", "install", "-r", req_file]
        # Unless we are in a virtualenv, we need --user
        if sys.base_prefix == sys.prefix and not hasattr(sys, "real_prefix"):
            pip.append("--user")

        try:
            subprocess.check_call(pip, stdout=stdout, stderr=stderr)
        except subprocess.CalledProcessError:
            raise Error(_("failed to install dependencies"))

        # Reload sys.path, to find recently installed packages
        importlib.reload(site)
1086460
def build_dependencies(self):
        '''
        '''

        cmd_list = ['pyang', '--plugindir', self.pyang_plugins]
        cmd_list += ['-p', self.dir_yang]
        cmd_list += ['-f', 'pyimport']
        cmd_list += [self.dir_yang + '/*.yang']
        logger.info('Building dependencies: {}'.format(' '.join(cmd_list)))
        p = Popen(' '.join(cmd_list), shell=True, stdout=PIPE, stderr=PIPE)
        stdout, stderr = p.communicate()
        logger.info('pyang return code is {}'.format(p.returncode))
        logger.debug(stderr.decode())
        parser = etree.XMLParser(remove_blank_text=True)
        self.dependencies = etree.XML(stdout.decode(), parser)
117569
def get(self, name):
        """"""
        if name not in self.modules:
            self.load_dependency(name, False, False, False)

        if name in self.modules:
            return self.modules[name]
        else:
            return None
1105493
def _install_dependencies(self, ui, debug):
        """"""
        for dep_t, dep_l in self.dependencies:
            if not dep_l:
                continue
            pkg_mgr = self.get_package_manager(dep_t)
            pkg_mgr.works()
            to_resolve = []
            for dep in dep_l:
                if not pkg_mgr.is_pkg_installed(dep):
                    to_resolve.append(dep)
            if not to_resolve:
                # nothing to install, let's move on
                continue
            to_install = pkg_mgr.resolve(*to_resolve)
            confirm = self._ask_to_confirm(ui, pkg_mgr, *to_install)
            if not confirm:
                msg = 'List of packages denied by user, exiting.'
                raise exceptions.DependencyException(msg)

            type(self).install_lock = True
            # TODO: we should do this more systematically (send signal to cl/gui?)
            logger.info('Installing dependencies, sit back and relax ...',
                        extra={'event_type': 'dep_installation_start'})
            if ui == 'cli' and not debug:  # TODO: maybe let every manager to decide when to start
                event = threading.Event()
                t = EndlessProgressThread(event)
                t.start()
            installed = pkg_mgr.install(*to_install)
            if ui == 'cli' and not debug:
                event.set()
                t.join()
                if installed:
                    logger.info(' Done.')
                else:
                    logger.error(' Failed.')
            type(self).install_lock = False

            log_extra = {'event_type': 'dep_installation_end'}
            if not installed:
                msg = 'Failed to install dependencies, exiting.'
                logger.error(msg, extra=log_extra)
                raise exceptions.DependencyException(msg)
            else:
                logger.info('Successfully installed dependencies!', extra=log_extra)
1007247
def get_dependencies(self):
        """"""
        # pylint: disable=no-member
        return super().get_dependencies() + [
            Data.collection_set,
            Data.entity_set,
            Data.parents,
        ]