changeset 834f16b60a7f in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=834f16b60a7f
description:
        Bundle CA certificates when freezing

        On Darwin either, Python uses its own copy of OpenSSL and so it does 
not use
        the certificate from the OS.

        issue8865
        review274421002
diffstat:

 bin/tryton      |   9 +++++----
 setup-freeze.py |  10 ++++++++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r 59ec3b45a481 -r 834f16b60a7f bin/tryton
--- a/bin/tryton        Tue Nov 26 22:34:49 2019 +0100
+++ b/bin/tryton        Thu Dec 05 21:24:43 2019 +0100
@@ -25,13 +25,14 @@
             etc, 'gtk-3.0', 'gtk.immodules')
     os.environ['GI_TYPELIB_PATH'] = os.path.join(
             prefix, 'lib', 'girepository-1.0')
+    os.environ.setdefault('SSL_CERT_FILE',
+        os.path.join(etc, 'ssl', 'cert.pem'))
+    os.environ.setdefault('SSL_CERT_DIR',
+        os.path.join(etc, 'ssl', 'certs'))
+
     if sys.platform == 'win32':
         # cx_freeze >= 5 put python modules under lib directory
         sys.path.append(os.path.join(prefix, 'lib'))
-        os.environ.setdefault('SSL_CERT_FILE',
-            os.path.join(etc, 'ssl', 'cert.pem'))
-        os.environ.setdefault('SSL_CERT_DIR',
-            os.path.join(etc, 'ssl', 'certs'))
 
     # On first launch the MacOSX app launcher may append an extra unique
     # argument starting with -psn_. This must be filtered to not crash the
diff -r 59ec3b45a481 -r 834f16b60a7f setup-freeze.py
--- a/setup-freeze.py   Tue Nov 26 22:34:49 2019 +0100
+++ b/setup-freeze.py   Thu Dec 05 21:24:43 2019 +0100
@@ -4,6 +4,7 @@
 
 import os
 import re
+import ssl
 import sys
 import tempfile
 from subprocess import Popen, PIPE, check_call
@@ -88,8 +89,6 @@
         'libcroco-0.6-3.dll',
         'libepoxy-0.dll',
         ])
-    include_files.append(
-        (os.path.join(sys.prefix, 'ssl'), os.path.join('etc', 'ssl')))
     lib_path = os.getenv('PATH', os.defpath).split(os.pathsep)
 else:
     lib_path = [os.path.join(sys.prefix, 'lib')]
@@ -102,6 +101,13 @@
         raise Exception('%s not found' % lib)
     include_files.append((path, lib))
 
+ssl_paths = ssl.get_default_verify_paths()
+include_files.append(
+    (ssl_paths.openssl_cafile, os.path.join('etc', 'ssl', 'cert.pem')))
+if os.path.exists(ssl_paths.openssl_capath):
+    include_files.append(
+        (ssl_paths.openssl_capath, os.path.join('etc', 'ssl', 'certs')))
+
 version = Popen(
     'python setup.py --version', stdout=PIPE, shell=True).stdout.read()
 version = version.strip()

Reply via email to