##// END OF EJS Templates
ssl: extract function that returns dummycert path on Apple python...
Yuya Nishihara -
r24288:922e087b default
parent child Browse files
Show More
@@ -129,6 +129,13 b' def _plainapplepython():'
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)
@@ -139,9 +146,9 b' def sslkwargs(ui, host):'
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
General Comments 0
You need to be logged in to leave comments. Login now