ssl: resolve symlink before checking for Apple python executable (issue4588)
authorYuya Nishihara <yuya@tcha.org>
Sat, 04 Apr 2015 14:56:18 +0900
changeset 24614 241d98d84aed
parent 24613 f8bc3de9b343
child 24615 9e558b788daa
ssl: resolve symlink before checking for Apple python executable (issue4588) test-https.t was broken at 07fafcd4bc74 if /usr/bin/pythonX.Y is used on Mac OS X. If python executable is not named as "python", run-tests.py creates a symlink and hghave uses it. On the other hand, the installed hg executable knows the real path to the system Python. Therefore, there was an inconsistency that hghave said it was not an Apple python but hg knew it was.
mercurial/sslutil.py
--- a/mercurial/sslutil.py	Fri Apr 03 18:19:24 2015 -0400
+++ b/mercurial/sslutil.py	Sat Apr 04 14:56:18 2015 +0900
@@ -129,9 +129,9 @@
       for using system certificate store CAs in addition to the provided
       cacerts file
     """
-    if sys.platform != 'darwin' or util.mainfrozen():
+    if sys.platform != 'darwin' or util.mainfrozen() or not sys.executable:
         return False
-    exe = (sys.executable or '').lower()
+    exe = os.path.realpath(sys.executable).lower()
     return (exe.startswith('/usr/bin/python') or
             exe.startswith('/system/library/frameworks/python.framework/'))