mercurial/sslutil.py
changeset 29483 918dce4b8c26
parent 29482 4e72995f6c9c
child 29484 53b7fc7cc2bb
equal deleted inserted replaced
29482:4e72995f6c9c 29483:918dce4b8c26
   195                 if not os.path.exists(cafile):
   195                 if not os.path.exists(cafile):
   196                     raise error.Abort(_('could not find web.cacerts: %s') %
   196                     raise error.Abort(_('could not find web.cacerts: %s') %
   197                                       cafile)
   197                                       cafile)
   198             else:
   198             else:
   199                 # CAs not defined in config. Try to find system bundles.
   199                 # CAs not defined in config. Try to find system bundles.
   200                 cafile = _defaultcacerts()
   200                 cafile = _defaultcacerts(ui)
   201                 if cafile:
   201                 if cafile:
   202                     ui.debug('using %s for CA file\n' % cafile)
   202                     ui.debug('using %s for CA file\n' % cafile)
   203 
   203 
   204             s['cafile'] = cafile
   204             s['cafile'] = cafile
   205 
   205 
   428         return False
   428         return False
   429     exe = os.path.realpath(sys.executable).lower()
   429     exe = os.path.realpath(sys.executable).lower()
   430     return (exe.startswith('/usr/bin/python') or
   430     return (exe.startswith('/usr/bin/python') or
   431             exe.startswith('/system/library/frameworks/python.framework/'))
   431             exe.startswith('/system/library/frameworks/python.framework/'))
   432 
   432 
   433 def _defaultcacerts():
   433 def _defaultcacerts(ui):
   434     """return path to default CA certificates or None."""
   434     """return path to default CA certificates or None."""
   435     if _plainapplepython():
   435     if _plainapplepython():
   436         dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem')
   436         dummycert = os.path.join(os.path.dirname(__file__), 'dummycert.pem')
   437         if os.path.exists(dummycert):
   437         if os.path.exists(dummycert):
   438             return dummycert
   438             return dummycert