Blame 0004-Canonicalize-bin_dir-when-looking-for-data_dir.patch

c440ca5
From c12dedd6d7934ca1698a66f848cd057bbf10bbee Mon Sep 17 00:00:00 2001
c440ca5
From: David Shea <dshea@redhat.com>
c440ca5
Date: Thu, 7 Jan 2016 10:02:27 -0500
c440ca5
Subject: [PATCH 4/4] Canonicalize bin_dir when looking for data_dir.
c440ca5
c440ca5
This way calling mypy as /bin/mypy will look for the data dir starting
c440ca5
in /usr instead of /.
c440ca5
---
c440ca5
 mypy/build.py | 4 ++++
c440ca5
 1 file changed, 4 insertions(+)
c440ca5
c440ca5
diff --git a/mypy/build.py b/mypy/build.py
c440ca5
index 2c54225..76c3326 100644
c440ca5
--- a/mypy/build.py
c440ca5
+++ b/mypy/build.py
c440ca5
@@ -210,6 +210,10 @@ def default_data_dir(bin_dir: str) -> str:
c440ca5
     if not bin_dir:
c440ca5
         # Default to directory containing this file's parent.
c440ca5
         return os.path.dirname(os.path.dirname(__file__))
c440ca5
+
c440ca5
+    # Canonicalize the path in case bin_dir is a symlink
c440ca5
+    bin_dir = os.path.realpath(bin_dir)
c440ca5
+
c440ca5
     base = os.path.basename(bin_dir)
c440ca5
     dir = os.path.dirname(bin_dir)
c440ca5
     if (sys.platform == 'win32' and base.lower() == 'scripts'
c440ca5
-- 
c440ca5
2.6.4
c440ca5