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

a4aba9f
From 6701ebf1208d5b129d83999dab4ea792c4f60c35 Mon Sep 17 00:00:00 2001
c440ca5
From: David Shea <dshea@redhat.com>
c440ca5
Date: Thu, 7 Jan 2016 10:02:27 -0500
a4aba9f
Subject: [PATCH 2/2] 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
a4aba9f
index 9f01b23..d79d0f5 100644
c440ca5
--- a/mypy/build.py
c440ca5
+++ b/mypy/build.py
a4aba9f
@@ -222,6 +222,10 @@ def default_data_dir(bin_dir: str) -> str:
a4aba9f
                 return os.path.join(lib, 'mypy')
c440ca5
         # Default to directory containing this file's parent.
a4aba9f
         return parent
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
-- 
a4aba9f
2.7.1
c440ca5