# HG changeset patch # User Yuya Nishihara # Date 1425475621 -32400 # Node ID 922e087ba158cead5ca55a9c3260c4777e963296 # Parent f78252429e0aff26196c096fd17460ae8adf86f0 ssl: extract function that returns dummycert path on Apple python This function will be the condition to switch DISABLEOSXDUMMYCERT in test-https.t. diff -r f78252429e0a -r 922e087ba158 mercurial/sslutil.py --- 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