changeset 9fd5904926bc in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=9fd5904926bc
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
(grafted from 834f16b60a7fe025a93923584681618d9c52b7a3)
diffstat:
bin/tryton | 9 +++++----
setup-freeze.py | 10 ++++++++--
2 files changed, 13 insertions(+), 6 deletions(-)
diffs (56 lines):
diff -r 7b1736628afe -r 9fd5904926bc bin/tryton
--- a/bin/tryton Mon Dec 02 20:40:42 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 7b1736628afe -r 9fd5904926bc setup-freeze.py
--- a/setup-freeze.py Mon Dec 02 20:40:42 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()