Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 449ba86

Browse files
committed
Add Python 3.9 to build.
1 parent 7dbad9d commit 449ba86

File tree

4 files changed

+60
-6
lines changed

4 files changed

+60
-6
lines changed

main.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,23 +231,26 @@ Build ZIP file of Python resources for Android, including CPython compiled as a
231231

232232
download jdk "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u242b08.tar.gz" "f39b523c724d0e0047d238eb2bb17a9565a60574cf651206c867ee5fc000ab43"
233233
download ndk "https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip" "8381c440fe61fcbb01e209211ac01b519cd6adf51ab1c2281d5daad6ca4c8c8c"
234-
download openssl "https://www.openssl.org/source/openssl-1.1.1g.tar.gz" "ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46"
234+
download openssl "https://www.openssl.org/source/openssl-1.1.1i.tar.gz" "e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242"
235235
download libffi "https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz" "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056"
236236
download xz "https://tukaani.org/xz/xz-5.2.5.tar.gz" "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10"
237237
download bzip2 "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz" "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269"
238238
download sqlite3 "http://archive.ubuntu.com/ubuntu/pool/main/s/sqlite3/sqlite3_3.11.0.orig.tar.xz" "79fb8800b8744337d5317270899a5a40612bb76f81517e131bf496c26b044490"
239-
download rubicon-java "https://github.com/beeware/rubicon-java/archive/v0.2.4.tar.gz" "1d075c19e01e04d5628f931ba5fb6f57820070846463e58989568cc3bd01c8d3"
239+
download rubicon-java "https://github.com/beeware/rubicon-java/archive/v0.2.5.tar.gz" "23ec17bb5cafec87e286b308f3b0cdd9eb004f59610c9bb37cacfa98ee1ea11c"
240240

241241
echo "Downloading Python version."
242242
case "$VERSION" in
243243
3.6)
244-
download "python-3.6" "https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tar.xz" "0a833c398ac8cd7c5538f7232d8531afef943c60495c504484f308dac3af40de"
244+
download "python-3.6" "https://www.python.org/ftp/python/3.6.12/Python-3.6.12.tar.xz" "70953a9b5d6891d92e65d184c3512126a15814bee15e1eff2ddcce04334e9a99"
245245
;;
246246
3.7)
247-
download "python-3.7" "https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz" "55a2cce72049f0794e9a11a84862e9039af9183603b78bc60d89539f82cf533f"
247+
download "python-3.7" "https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tar.xz" "91923007b05005b5f9bd46f3b9172248aea5abc1543e8a636d59e629c3331b01"
248248
;;
249249
3.8)
250-
download "python-3.8" "https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tar.xz" "dfab5ec723c218082fe3d5d7ae17ecbdebffa9a1aea4d64aa3a2ecdd2e795864"
250+
download "python-3.8" "https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tar.xz" "ddcc1df16bb5b87aa42ec5d20a5b902f2d088caa269b28e01590f97a798ec50a"
251+
;;
252+
3.9)
253+
download "python-3.9" "https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tar.xz" "991c3f8ac97992f3d308fefeb03a64db462574eadbff34ce8bc5bb583d9903ff"
251254
;;
252255
*)
253256
echo "Invalid Python version: $VERSION"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 86b7aee31eb66b99e2e9ff55f83cb2e6393dd8d3 Mon Sep 17 00:00:00 2001
2+
From: Asheesh Laroia <[email protected]>
3+
Date: Fri, 19 Jun 2020 16:47:25 -0700
4+
Subject: [PATCH] Parse certificate authority certs from Android
5+
/etc/security/cacerts directory
6+
7+
---
8+
Lib/ssl.py | 11 +++++++++++
9+
Lib/test/test_ssl.py | 1 +
10+
2 files changed, 12 insertions(+)
11+
12+
diff --git a/Lib/ssl.py b/Lib/ssl.py
13+
index 0726caee49..3878bdd8fa 100644
14+
--- a/Lib/ssl.py
15+
+++ b/Lib/ssl.py
16+
@@ -572,6 +572,17 @@ class SSLContext(_SSLContext):
17+
if sys.platform == "win32":
18+
for storename in self._windows_cert_stores:
19+
self._load_windows_store_certs(storename, purpose)
20+
+ if os.path.exists('/etc/security/cacerts'):
21+
+ certs = []
22+
+ for basename in os.listdir('/etc/security/cacerts'):
23+
+ with open('/etc/security/cacerts/' + basename) as fd:
24+
+ s = fd.read()
25+
+ if 'END CERTIFICATE' not in s:
26+
+ continue
27+
+ lines = s.split('\n')
28+
+ line_end_certificate = [i for i, line in enumerate(lines) if 'END CERTIFICATE' in line][0]
29+
+ certs.append('\n'.join(lines[0:line_end_certificate+1]))
30+
+ self.load_verify_locations(None, None, '\n'.join(certs))
31+
self.set_default_verify_paths()
32+
33+
if hasattr(_SSLContext, 'minimum_version'):
34+
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
35+
index 0bc0a8c452..3c79debf3e 100644
36+
--- a/Lib/test/test_ssl.py
37+
+++ b/Lib/test/test_ssl.py
38+
@@ -1580,6 +1580,7 @@ class ContextTests(unittest.TestCase):
39+
@unittest.skipIf(sys.platform == "win32", "not-Windows specific")
40+
@unittest.skipIf(IS_LIBRESSL, "LibreSSL doesn't support env vars")
41+
def test_load_default_certs_env(self):
42+
+ raise unittest.SkipTest("Skipping this test for Python within an Android app")
43+
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
44+
with support.EnvironmentVarGuard() as env:
45+
env["SSL_CERT_DIR"] = CAPATH
46+
--
47+
2.27.0
48+

patches/3.9/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01_python_ssl_module_add_android_certificates

python.Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ RUN cd openssl-src && make install SHLIB_EXT='${SHLIB_VERSION_NUMBER}.so'
105105
# requires itself to be installed globally during a cross-compile, and Python 3.6 additionally
106106
# requires Python 2 to be installed at build time.
107107
FROM toolchain as build_python
108-
RUN apt-get update -qq && apt-get -qq install python python3.6 python3.7 python3.8 pkg-config zip quilt
108+
RUN apt-get update -qq && apt-get -qq install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates
109+
RUN apt-add-repository ppa:deadsnakes/ppa
110+
RUN apt-get update -qq && apt-get -qq install python python3.6 python3.7 python3.8 python3.9 pkg-config zip quilt
109111

110112
# Get libs & vars
111113
COPY --from=build_openssl /opt/python-build/built/openssl /opt/python-build/built/openssl

0 commit comments

Comments
 (0)