Blob Blame History Raw
From 6701ebf1208d5b129d83999dab4ea792c4f60c35 Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Thu, 7 Jan 2016 10:02:27 -0500
Subject: [PATCH 2/2] Canonicalize bin_dir when looking for data_dir.

This way calling mypy as /bin/mypy will look for the data dir starting
in /usr instead of /.
---
 mypy/build.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mypy/build.py b/mypy/build.py
index 9f01b23..d79d0f5 100644
--- a/mypy/build.py
+++ b/mypy/build.py
@@ -222,6 +222,10 @@ def default_data_dir(bin_dir: str) -> str:
                 return os.path.join(lib, 'mypy')
         # Default to directory containing this file's parent.
         return parent
+
+    # Canonicalize the path in case bin_dir is a symlink
+    bin_dir = os.path.realpath(bin_dir)
+
     base = os.path.basename(bin_dir)
     dir = os.path.dirname(bin_dir)
     if (sys.platform == 'win32' and base.lower() == 'scripts'
-- 
2.7.1