comparison mercurial/sslutil.py @ 34647:dacfcdd8b94e

codemod: use pycompat.isdarwin This is done by: sed -i "s/pycompat\.sysplatform == 'darwin'/pycompat.isdarwin/" **/*.py Plus a manual change to `sslutil.py` which involves indentation change that cannot be done by `sed`. Differential Revision: https://phab.mercurial-scm.org/D1035
author Jun Wu <quark@fb.com>
date Thu, 12 Oct 2017 23:34:34 -0700
parents 75979c8d4572
children 8c1d0fe1f431
comparison
equal deleted inserted replaced
34646:238abf65a8ad 34647:dacfcdd8b94e
675 system 675 system
676 * presumably is an Apple Python that uses Apple OpenSSL which has patches 676 * presumably is an Apple Python that uses Apple OpenSSL which has patches
677 for using system certificate store CAs in addition to the provided 677 for using system certificate store CAs in addition to the provided
678 cacerts file 678 cacerts file
679 """ 679 """
680 if (pycompat.sysplatform != 'darwin' or 680 if (not pycompat.isdarwin or util.mainfrozen() or
681 util.mainfrozen() or not pycompat.sysexecutable): 681 not pycompat.sysexecutable):
682 return False 682 return False
683 exe = os.path.realpath(pycompat.sysexecutable).lower() 683 exe = os.path.realpath(pycompat.sysexecutable).lower()
684 return (exe.startswith('/usr/bin/python') or 684 return (exe.startswith('/usr/bin/python') or
685 exe.startswith('/system/library/frameworks/python.framework/')) 685 exe.startswith('/system/library/frameworks/python.framework/'))
686 686
734 if os.path.exists(dummycert): 734 if os.path.exists(dummycert):
735 return dummycert 735 return dummycert
736 736
737 # The Apple OpenSSL trick isn't available to us. If Python isn't able to 737 # The Apple OpenSSL trick isn't available to us. If Python isn't able to
738 # load system certs, we're out of luck. 738 # load system certs, we're out of luck.
739 if pycompat.sysplatform == 'darwin': 739 if pycompat.isdarwin:
740 # FUTURE Consider looking for Homebrew or MacPorts installed certs 740 # FUTURE Consider looking for Homebrew or MacPorts installed certs
741 # files. Also consider exporting the keychain certs to a file during 741 # files. Also consider exporting the keychain certs to a file during
742 # Mercurial install. 742 # Mercurial install.
743 if not _canloaddefaultcerts: 743 if not _canloaddefaultcerts:
744 ui.warn(_('(unable to load CA certificates; see ' 744 ui.warn(_('(unable to load CA certificates; see '