equal
deleted
inserted
replaced
4 # Copyright 2006, 2007 Alexis S. L. Carvalho <alexis@cecm.usp.br> |
4 # Copyright 2006, 2007 Alexis S. L. Carvalho <alexis@cecm.usp.br> |
5 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
5 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
6 # |
6 # |
7 # This software may be used and distributed according to the terms of the |
7 # This software may be used and distributed according to the terms of the |
8 # GNU General Public License version 2 or any later version. |
8 # GNU General Public License version 2 or any later version. |
9 import os |
9 import os, sys |
10 |
10 |
11 from mercurial import util |
11 from mercurial import util |
12 from mercurial.i18n import _ |
12 from mercurial.i18n import _ |
13 try: |
13 try: |
14 # avoid using deprecated/broken FakeSocket in python 2.6 |
14 # avoid using deprecated/broken FakeSocket in python 2.6 |
102 cacerts = ui.config('web', 'cacerts') |
102 cacerts = ui.config('web', 'cacerts') |
103 if cacerts: |
103 if cacerts: |
104 cacerts = util.expandpath(cacerts) |
104 cacerts = util.expandpath(cacerts) |
105 if not os.path.exists(cacerts): |
105 if not os.path.exists(cacerts): |
106 raise util.Abort(_('could not find web.cacerts: %s') % cacerts) |
106 raise util.Abort(_('could not find web.cacerts: %s') % cacerts) |
|
107 elif cacerts is None and sys.platform == 'darwin' and not util.mainfrozen(): |
|
108 dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem') |
|
109 if os.path.exists(dummycert): |
|
110 ui.debug('using %s to enable OS X system CA\n' % dummycert) |
|
111 ui.setconfig('web', 'cacerts', dummycert, 'dummy') |
|
112 cacerts = dummycert |
|
113 if cacerts: |
107 kws.update({'ca_certs': cacerts, |
114 kws.update({'ca_certs': cacerts, |
108 'cert_reqs': CERT_REQUIRED, |
115 'cert_reqs': CERT_REQUIRED, |
109 }) |
116 }) |
110 return kws |
117 return kws |
111 |
118 |