Skip to content

Fixed being unable to find distutils submodules by name when in a virtualenv #672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2019

Conversation

AWhetter
Copy link
Contributor

Description

When in a virtualenv, distutils is patched to pick up submodules from the original Python and not from the virtualenv. This is done by prepending the location of the outside distutils to the __path__ of the module.
Because astroid already uses distutils, it is already imported. Therefore we can use the already imported module to find what __path__ should be, and use that to look for submodules.

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
📜 Docs

Related Issue

Closes pylint-dev/pylint#73

@PCManticore
Copy link
Contributor

Great fix! 👏

@PCManticore PCManticore merged commit 6ca01e0 into master May 23, 2019
@PCManticore PCManticore deleted the fix_pylint_73 branch May 23, 2019 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pylint is unable to import distutils.version under virtualenv
2 participants