8000 Fix for issue #1225 by allthedata · Pull Request #1263 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Fix for issue #1225 #1263

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 2 commits into from
Mar 3, 2016
Merged
Changes from 1 commit
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
Next Next commit
Fix for issue #1225
  • Loading branch information
allthedata committed Mar 2, 2016
commit 9b7c7d191ef27884b397eceee646873495f8cf02
25 changes: 17 additions & 8 deletions mypy/build.py
Original file line number Diff line number Diff line change Expand Up @@ -213,17 +213,26 @@ def build(sources: List[BuildSource],

def default_data_dir(bin_dir: str) -> str: # TODO fix this logic """Returns directory containing typeshed directory
Args: bin_dir: directory containing the mypy script """ if not bin_dir: mypy_package = os.path.dirname(__file__) parent = os.path.dirname(mypy_package) if os.path.basename(parent) == 'site-packages': # Installed in site-packages, but invoked with python3 -m mypy; # __file__ is .../blah/lib/python3.N/site-packages/mypy/__init__.py; if (os.path.basename(parent) == 'site-packages' or os.path.basename(parent) == 'dist-packages'): # Installed in site-packages or dist-packages, but invoked with python3 -m mypy; # __file__ is .../blah/lib/python3.N/site-packages/mypy/build.py # or .../blah/lib/python3.N/dist-packages/mypy/build.py (Debian) # or .../blah/lib/site-packages/mypy/build.py (Windows) # blah may be a virtualenv or /usr/local. We want .../blah/lib/mypy. lib = os.path.dirname(os.path.dirname(parent)) if os.path.basename(lib) == 'lib': return os.path.join(lib, 'mypy') lib = parent for i in range(2): lib = os.path.dirname(lib) if os.path.basename(lib) == 'lib': return os.path.join(lib, 'mypy') subdir = os.path.join(parent, 'lib', 'mypy') if os.path.isdir(subdir): # If installed via buildout, the __file__ is Expand All @@ -240,7 +249,7 @@ def default_data_dir(bin_dir: str) -> str: return os.path.join(dir, 'Lib', 'mypy') elif base == 'scripts': # Assume that we have a repo check out or unpacked source tarball. return os.path.dirname(bin_dir) return dir elif base == 'bin': # Installed to somewhere (can be under /usr/local or anywhere). return os.path.join(dir, 'lib', 'mypy') Expand Down
0