From patchwork Sat Apr 4 07:32:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: ssl: resolve symlink before checking for Apple python executable (issue4588) From: Yuya Nishihara X-Patchwork-Id: 8496 Message-Id: To: mercurial-devel@selenic.com Date: Sat, 04 Apr 2015 16:32:29 +0900 # HG changeset patch # User Yuya Nishihara # Date 1428126978 -32400 # Sat Apr 04 14:56:18 2015 +0900 # Node ID c65f355d57a2be8f4e9c0ed0ca734ba9cec83c8d # Parent 4a4018831d2ebc3c9cae9c6613e6a2497b4f0993 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. diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -129,9 +129,9 @@ def _plainapplepython(): 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/'))