def test__get_pip_info(): packages = _get_pip_info("pipupgrade", "pytest") assert packages["pipupgrade"]["name"] == NAME assert packages["pipupgrade"]["author"] == __author__ assert packages["pytest"]["name"] == "pytest"
def _build_packages_info_dict(packages, pip_exec = None): details = _get_pip_info(*packages, pip_exec = pip_exec) requirements = [ ] for name, detail in iteritems(details): if not name in _INFO_DICT: _INFO_DICT[name] = dict({ "version": detail["version"], "dependencies": compact(detail["requires"].split(", ")) }) for requirement in _INFO_DICT[name]["dependencies"]: if requirement not in requirements: requirements.append(requirement) if requirements: _build_packages_info_dict(requirements, pip_exec = pip_exec)