From 12cca9dea121d09a5876a973d246d85baa44358a Mon Sep 17 00:00:00 2001 From: Safihre Date: Sun, 13 Aug 2017 19:50:45 +0200 Subject: [PATCH] Provide certificates with macOS and Windows build We have to bring our own certficates on Homebrew Python The certifi package brings the latest certificates on build This will cause the create_default_context to load it automatically We also use this on Windows so users are always up-to-date --- SABnzbd.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SABnzbd.py b/SABnzbd.py index b3bd178..66917e1 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1174,6 +1174,15 @@ def main(): if not sabnzbd.WIN32 and not sabnzbd.DARWIN and not ('utf' in preferredencoding.lower() and '8' in preferredencoding.lower()): logging.warning(T("SABnzbd was started with encoding %s, this should be UTF-8. Expect problems with Unicoded file and directory names in downloads.") % preferredencoding) + # Load extra certificates + if hasattr(sys, "frozen"): + # The certifi package brings the latest certificates on build + # This will cause the create_default_context to load it automatically + import certifi + os.environ["SSL_CERT_FILE"] = certifi.where() + logging.info('Loaded additional certificates from %s', os.environ["SSL_CERT_FILE"]) + + # Extra startup info if sabnzbd.cfg.log_level() > 1: from sabnzbd.getipaddress import localipv4, publicipv4, ipv6 @@ -1686,9 +1695,8 @@ if __name__ == '__main__': main() elif getattr(sys, 'frozen', None) == 'macosx_app': - # OSX binary - try: + # OSX binary runner from PyObjCTools import AppHelper from sabnzbd.osxmenu import SABnzbdDelegate @@ -1713,9 +1721,7 @@ if __name__ == '__main__': sabApp = startApp() sabApp.start() AppHelper.runEventLoop() - except: main() - else: main()