comparison mercurial/sslutil.py @ 30641:16b5df5792a8

py3: replace sys.platform with pycompat.sysplatform (part 1 of 2) sys.platform returns unicode on python 3 world. Our code base has most of the things bytes because of the transformer. So we have a bytes version of this as pycompat.sysplatform. This series of 2 patches replaces occurences of sys.platform with pycompat.sysplatform.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 19 Dec 2016 02:15:24 +0530
parents d524c88511a7
children 10b17ed9b591
comparison
equal deleted inserted replaced
30640:7a3e67bfa417 30641:16b5df5792a8
666 system 666 system
667 * presumably is an Apple Python that uses Apple OpenSSL which has patches 667 * presumably is an Apple Python that uses Apple OpenSSL which has patches
668 for using system certificate store CAs in addition to the provided 668 for using system certificate store CAs in addition to the provided
669 cacerts file 669 cacerts file
670 """ 670 """
671 if sys.platform != 'darwin' or util.mainfrozen() or not sys.executable: 671 if (pycompat.sysplatform != 'darwin' or
672 util.mainfrozen() or not sys.executable):
672 return False 673 return False
673 exe = os.path.realpath(sys.executable).lower() 674 exe = os.path.realpath(sys.executable).lower()
674 return (exe.startswith('/usr/bin/python') or 675 return (exe.startswith('/usr/bin/python') or
675 exe.startswith('/system/library/frameworks/python.framework/')) 676 exe.startswith('/system/library/frameworks/python.framework/'))
676 677
723 if os.path.exists(dummycert): 724 if os.path.exists(dummycert):
724 return dummycert 725 return dummycert
725 726
726 # The Apple OpenSSL trick isn't available to us. If Python isn't able to 727 # The Apple OpenSSL trick isn't available to us. If Python isn't able to
727 # load system certs, we're out of luck. 728 # load system certs, we're out of luck.
728 if sys.platform == 'darwin': 729 if pycompat.sysplatform == 'darwin':
729 # FUTURE Consider looking for Homebrew or MacPorts installed certs 730 # FUTURE Consider looking for Homebrew or MacPorts installed certs
730 # files. Also consider exporting the keychain certs to a file during 731 # files. Also consider exporting the keychain certs to a file during
731 # Mercurial install. 732 # Mercurial install.
732 if not _canloaddefaultcerts: 733 if not _canloaddefaultcerts:
733 ui.warn(_('(unable to load CA certificates; see ' 734 ui.warn(_('(unable to load CA certificates; see '