Skip to content

Fix broken installation on Windows in virtualenv #4149

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
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import binascii
import collections
import contextlib
from distutils.sysconfig import get_python_lib
import gc
import hashlib
import json
Expand Down Expand Up @@ -229,7 +230,12 @@ def default_data_dir(bin_dir: Optional[str]) -> str:
"""
if not bin_dir:
if os.name == 'nt':
prefixes = [os.path.join(sys.prefix, 'Lib'), os.path.join(site.getuserbase(), 'lib')]
prefixes = [os.path.join(sys.prefix, 'Lib')]
try:
prefixes.append(os.path.join(site.getuserbase(), 'lib'))
except AttributeError:
# getuserbase in not available in virtualenvs
prefixes.append(os.path.join(get_python_lib(), 'lib'))
for parent in prefixes:
data_dir = os.path.join(parent, 'mypy')
if os.path.exists(data_dir):
Expand Down