Traceback (most recent call last): File "/usr/lib/python-exec/python3.4/mypy", line 169, in <module> main() File "/usr/lib/python-exec/python3.4/mypy", line 34, in main type_check_only(path, module, bin_dir, options) File "/usr/lib/python-exec/python3.4/mypy", line 78, in type_check_only python_path=options.python_path) File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 122, in build data_dir = default_data_dir(bin_dir) File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 191, in default_data_dir raise RuntimeError("Broken installation: can't determine base dir") RuntimeError: Broken installation: can't determine base dir The reason is that bin_dir is os.path.dirname(__file__) __file__=/usr/lib/python-exec/python3.4/mypy then bindir=/usr/lib/python-exec/python3.4 instead of /usr/bin/mypy. This can be fixed: --- a/scripts/mypy +++ b/scripts/mypy @@ -41,19 +41,7 @@ def find_bin_directory() -> str: - """Find the directory that contains this script. - - This is used by build to find stubs and other data files. - """ - return '/usr/bin' - script = __file__ - # Follow up to 5 symbolic links (cap to avoid cycles). - for i in range(5): - if os.path.islink(script): - script = readlinkabs(script) - else: - break - return os.path.dirname(script) + return os.path.dirname(shutil.which('mypy')) def readlinkabs(link: str) -> str: Reproducible: Always
I've got an upstream issue open for this and I recommend you submit this patch there so it can be incorporated into mypy. https://github.com/JukkaL/mypy/issues/653 I'll get this incorporated into the ebuild this weekend and if I don't see a pull request for this I'll add one but highly encourage you to provide the pull request since you've already taken the time to determine the patch.
Added this patch to the tree and mentioned it upstream. If there is anything else, let me know.