127 return False |
127 return False |
128 exe = (sys.executable or '').lower() |
128 exe = (sys.executable or '').lower() |
129 return (exe.startswith('/usr/bin/python') or |
129 return (exe.startswith('/usr/bin/python') or |
130 exe.startswith('/system/library/frameworks/python.framework/')) |
130 exe.startswith('/system/library/frameworks/python.framework/')) |
131 |
131 |
|
132 def _defaultcacerts(): |
|
133 if _plainapplepython(): |
|
134 dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem') |
|
135 if os.path.exists(dummycert): |
|
136 return dummycert |
|
137 return None |
|
138 |
132 def sslkwargs(ui, host): |
139 def sslkwargs(ui, host): |
133 kws = {} |
140 kws = {} |
134 hostfingerprint = ui.config('hostfingerprints', host) |
141 hostfingerprint = ui.config('hostfingerprints', host) |
135 if hostfingerprint: |
142 if hostfingerprint: |
136 return kws |
143 return kws |
137 cacerts = ui.config('web', 'cacerts') |
144 cacerts = ui.config('web', 'cacerts') |
138 if cacerts: |
145 if cacerts: |
139 cacerts = util.expandpath(cacerts) |
146 cacerts = util.expandpath(cacerts) |
140 if not os.path.exists(cacerts): |
147 if not os.path.exists(cacerts): |
141 raise util.Abort(_('could not find web.cacerts: %s') % cacerts) |
148 raise util.Abort(_('could not find web.cacerts: %s') % cacerts) |
142 elif cacerts is None and _plainapplepython(): |
149 elif cacerts is None: |
143 dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem') |
150 dummycert = _defaultcacerts() |
144 if os.path.exists(dummycert): |
151 if dummycert: |
145 ui.debug('using %s to enable OS X system CA\n' % dummycert) |
152 ui.debug('using %s to enable OS X system CA\n' % dummycert) |
146 ui.setconfig('web', 'cacerts', dummycert, 'dummy') |
153 ui.setconfig('web', 'cacerts', dummycert, 'dummy') |
147 cacerts = dummycert |
154 cacerts = dummycert |
148 if cacerts: |
155 if cacerts: |
149 kws.update({'ca_certs': cacerts, |
156 kws.update({'ca_certs': cacerts, |