diff --git a/vpip/commands/list.py b/vpip/commands/list.py index 89b94bf..0b44868 100644 --- a/vpip/commands/list.py +++ b/vpip/commands/list.py @@ -24,11 +24,13 @@ def iter_global_packages(): :rtype: Iterator[PackageInfo] """ + from packaging.requirements import Requirement from .. import venv, pip_api - for name in venv.iter_global_packages(): - vv = venv.get_global_pkg_venv(name) + for dir_name in venv.iter_global_packages(): + vv = venv.get_global_pkg_venv(dir_name) with vv.activate(): - yield PackageInfo(name, pip_api.show([name])[0].version) + req = Requirement(dir_name) + yield PackageInfo(req.name, pip_api.show([req.name])[0].version) def print_global_packages(check_outdated=False): for info in iter_global_packages(): @@ -116,4 +118,4 @@ def __str__(self): else: lines.append("{} (not installed)".format(self.name)) return "\n".join(lines) - \ No newline at end of file +