[PATCH 1 of 4 V2] ssl: extract function that returns dummycert path on Apple python
Yuya Nishihara
yuya at tcha.org
Thu Mar 12 15:41:54 UTC 2015
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1425475621 -32400
# Wed Mar 04 22:27:01 2015 +0900
# Node ID 7ed8cbb3b76b9e15940e967d4620c2eac028fad1
# Parent f29939bf06ff33ec50a1647f9048af25ee20a702
ssl: extract function that returns dummycert path on Apple python
This function will be the condition to switch DISABLEOSXDUMMYCERT in
test-https.t.
diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -129,6 +129,13 @@ def _plainapplepython():
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 @@ def sslkwargs(ui, host):
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
More information about the Mercurial-devel
mailing list