comparison mercurial/sslutil.py @ 24614:241d98d84aed

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.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 04 Apr 2015 14:56:18 +0900
parents 760a86865f80
children 21b536f01eda
comparison
equal deleted inserted replaced
24613:f8bc3de9b343 24614:241d98d84aed
127 system 127 system
128 * presumably is an Apple Python that uses Apple OpenSSL which has patches 128 * presumably is an Apple Python that uses Apple OpenSSL which has patches
129 for using system certificate store CAs in addition to the provided 129 for using system certificate store CAs in addition to the provided
130 cacerts file 130 cacerts file
131 """ 131 """
132 if sys.platform != 'darwin' or util.mainfrozen(): 132 if sys.platform != 'darwin' or util.mainfrozen() or not sys.executable:
133 return False 133 return False
134 exe = (sys.executable or '').lower() 134 exe = os.path.realpath(sys.executable).lower()
135 return (exe.startswith('/usr/bin/python') or 135 return (exe.startswith('/usr/bin/python') or
136 exe.startswith('/system/library/frameworks/python.framework/')) 136 exe.startswith('/system/library/frameworks/python.framework/'))
137 137
138 def _defaultcacerts(): 138 def _defaultcacerts():
139 """return path to CA certificates; None for system's store; ! to disable""" 139 """return path to CA certificates; None for system's store; ! to disable"""