Subject: [PATCH] py3-requests: drop py3-certffi dependency

From: Drew DeVault <[email-masked]>
Date: Mon, 21 Sep 2020 16:39:32 -0600

---
 main/py3-requests/APKBUILD    | 15 +++++++++++----
 main/py3-requests/certs.patch | 14 ++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)
 create mode 100644 main/py3-requests/certs.patch

diff --git a/main/py3-requests/APKBUILD b/main/py3-requests/APKBUILD
index 88ee28c160..364f4d774d 100644
--- a/main/py3-requests/APKBUILD
+++ b/main/py3-requests/APKBUILD
@@ -3,16 +3,22 @@
 pkgname=py3-requests
 _pkgname=requests
 pkgver=2.24.0
-pkgrel=0
+pkgrel=1
 pkgdesc="A HTTP request library for Python3"
 url="http://www.python-requests.org/"
 arch="noarch"
 license="Apache-2.0"
 # Requirements for tests are not available in main
 options="!check"
-depends="python3 py3-chardet py3-idna py3-certifi py3-urllib3"
+depends="python3 py3-chardet py3-idna py3-urllib3"
 makedepends="py3-setuptools"
-source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
+# certs.patch forces requests to use the system certificate store by default,
+# and eliminates the certffi dependency. Thanks to Eli Schwartz of Arch Linux
+# for the recommendation.
+source="
+	https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
+	certs.patch
+"
 builddir="$srcdir/$_pkgname-$pkgver"
 
 replaces="py-requests" # Backwards compatibility
@@ -26,4 +32,5 @@ package() {
 	python3 setup.py install --prefix=/usr --root="$pkgdir"
 }
 
-sha512sums="46ca8ab70eb39be8398c242404b9b3ffb6baddd5c78eaad125b55c719154eb8c7b6a737a8dc587b0cb51b3b9a074abaa8b2ff347a64d38f4f90cdba4db16a119  requests-2.24.0.tar.gz"
+sha512sums="46ca8ab70eb39be8398c242404b9b3ffb6baddd5c78eaad125b55c719154eb8c7b6a737a8dc587b0cb51b3b9a074abaa8b2ff347a64d38f4f90cdba4db16a119  requests-2.24.0.tar.gz
+424a3bb01b23409284f6c9cd2bc22d92df31b85cfd96e1d1b16b5d68adeca670dfed4fff7977d8b10980102b0f780eacc465431021fcd661f3a17168a02a39a3  certs.patch"
diff --git a/main/py3-requests/certs.patch b/main/py3-requests/certs.patch
new file mode 100644
index 0000000000..47a32f3802
--- /dev/null
+++ b/main/py3-requests/certs.patch
@@ -0,0 +1,14 @@
+diff --git a/requests/certs.py b/requests/certs.py
+index d1a378d7..4e0bffd4 100644
+--- a/requests/certs.py
++++ b/requests/certs.py
+@@ -12,7 +12,8 @@ If you are packaging Requests, e.g., for a Linux distribution or a managed
+ environment, you can change the definition of where() to return a separately
+ packaged CA bundle.
+ """
+-from certifi import where
++def where():
++    return "/etc/ssl/certs/ca-certificates.crt"
+ 
+ if __name__ == '__main__':
+     print(where())
-- 
2.28.0