Mercurial > hg
changeset 24288:922e087ba158
ssl: extract function that returns dummycert path on Apple python
This function will be the condition to switch DISABLEOSXDUMMYCERT in
test-https.t.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 04 Mar 2015 22:27:01 +0900 |
parents | f78252429e0a |
children | 07fafcd4bc74 |
files | mercurial/sslutil.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/sslutil.py Wed Mar 11 21:36:48 2015 -0700 +++ b/mercurial/sslutil.py Wed Mar 04 22:27:01 2015 +0900 @@ -129,6 +129,13 @@ return (exe.startswith('/usr/bin/python') or exe.startswith('/system/library/frameworks/python.framework/')) +def _defaultcacerts(): + if _plainapplepython(): + dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem') + if os.path.exists(dummycert): + return dummycert + return None + def sslkwargs(ui, host): kws = {} hostfingerprint = ui.config('hostfingerprints', host) @@ -139,9 +146,9 @@ cacerts = util.expandpath(cacerts) if not os.path.exists(cacerts): raise util.Abort(_('could not find web.cacerts: %s') % cacerts) - elif cacerts is None and _plainapplepython(): - dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem') - if os.path.exists(dummycert): + elif cacerts is None: + dummycert = _defaultcacerts() + if dummycert: ui.debug('using %s to enable OS X system CA\n' % dummycert) ui.setconfig('web', 'cacerts', dummycert, 'dummy') cacerts = dummycert