Skip to content

Commit

Permalink
Avoid removing packages imported from the root. Fixes #1383.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jul 9, 2018
1 parent e1fb174 commit 949bd16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/1383.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In pkg_resources VendorImporter, avoid removing packages imported from the root.
2 changes: 1 addition & 1 deletion pkg_resources/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def load_module(self, fullname):
# on later Python versions to cause relative imports
# in the vendor package to resolve the same modules
# as those going through this importer.
if sys.version_info > (3, 3):
if prefix and sys.version_info > (3, 3):
del sys.modules[extant]
return mod
except ImportError:
Expand Down

1 comment on commit 949bd16

@richard-scott
Copy link

@richard-scott richard-scott commented on 949bd16 Jul 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the change to /usr/lib/python3/dist-packages/pkg_resources/extern/__init__.py
and I still get this:

$ pip3 list --format=freeze --outdated
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 157, in run
    packages = self.get_outdated(packages, options)
  File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 168, in get_outdated
    dist for dist in self.iter_packages_latest_infos(packages, options)
  File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 169, in <listcomp>
    if dist.latest_version > dist.parsed_version
TypeError: '>' not supported between instances of 'Version' and 'Version'

Please sign in to comment.