summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcell Meszaros2022-06-04 00:29:17 +0200
committerMarcell Meszaros2022-06-04 00:49:43 +0200
commitf4be58d62bf5c1a28fb774d7da32b4627b6f96e8 (patch)
tree2731a0a541d349f409f4f9ed9890d55a9bede03a
downloadaur-f4be58d62bf5c1a28fb774d7da32b4627b6f96e8.tar.gz
import from extra, adapted to Python 2
-rw-r--r--.SRCINFO19
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD64
-rw-r--r--certs.patch14
4 files changed, 102 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..3c41291ee54b
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = python2-requests
+ pkgdesc = HTTP for Humans (for Python 2)
+ pkgver = 2.27.1
+ pkgrel = 1
+ url = http://python-requests.org
+ arch = any
+ license = Apache
+ makedepends = python2-setuptools
+ depends = python2
+ depends = python2-urllib3
+ depends = python2-chardet
+ depends = python2-idna
+ optdepends = python2-pysocks: SOCKS proxy support
+ source = https://github.com/psf/requests/archive/v2.27.1/python2-requests-2.27.1.tar.gz
+ source = certs.patch
+ b2sums = 302fa6f3be95840e7c79a036d5d6bf354f9db0857542969759690c312b31e26fc4779e886b616bd624cb17a53da0342597988bd4aee88dbeb0f6a2442b8a6ced
+ b2sums = b6a7c9796a8ffedebcdbf0d2f95c40b1bbfa0beb45a3c7d5b493a459c4516533992291c720cf02e291cdbbf554dd0bf25c1312f4be41e39acd586b41911ad5b0
+
+pkgname = python2-requests
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..7334925ab911
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*
+!.gitignore
+!.SRCINFO
+!PKGBUILD
+!*.patch
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..831592378c5e
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,64 @@
+# Contributor: Marcell Meszaros < marcell.meszaros AT runbox.eu >
+# Contributor: Felix Yan <felixonmars@archlinux.org>
+# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
+
+pkgname=python2-requests
+pkgver=2.27.1
+pkgrel=1
+pkgdesc='HTTP for Humans (for Python 2)'
+arch=('any')
+url='http://python-requests.org'
+license=('Apache')
+depends=(
+ 'python2'
+ 'python2-urllib3'
+ 'python2-chardet'
+ 'python2-idna'
+)
+makedepends=('python2-setuptools')
+# checkdepends=(
+# 'python2-pytest'
+# 'python2-pytest-httpbin'
+# 'python2-pytest-mock'
+# 'python2-pysocks'
+# 'python2-trustme'
+# )
+optdepends=('python2-pysocks: SOCKS proxy support')
+source=("https://github.com/psf/requests/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
+ certs.patch)
+b2sums=('302fa6f3be95840e7c79a036d5d6bf354f9db0857542969759690c312b31e26fc4779e886b616bd624cb17a53da0342597988bd4aee88dbeb0f6a2442b8a6ced'
+ 'b6a7c9796a8ffedebcdbf0d2f95c40b1bbfa0beb45a3c7d5b493a459c4516533992291c720cf02e291cdbbf554dd0bf25c1312f4be41e39acd586b41911ad5b0')
+
+prepare() {
+ cd requests-$pkgver
+ # Stay with chardet for now: https://github.com/psf/requests/issues/5871
+ sed -e '/certifi/d' \
+ -e "s/,<.*'/'/" \
+ -e '/charset_normalizer/d' \
+ -i setup.py
+ patch -p1 -i "$srcdir"/certs.patch
+
+ # Change hashbangs to python2
+ sed -e 's+^\(#!/usr/bin/env python\)+\12+' \
+ -i 'requests/certs.py' \
+ -i 'setup.py'
+}
+
+build() {
+ cd requests-$pkgver
+ python2 setup.py build
+}
+
+# check() {
+# # Seems to be a problem about pytest-httpbin:
+# # pytest-httpbin server hit an exception serving request: [SSL: HTTP_REQUEST] http request (_ssl.c:1129)
+# # pytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1129)
+#
+# cd requests-$pkgver
+# pytest tests --deselect tests/test_requests.py::TestRequests::test_pyopenssl_redirect
+# }
+
+package() {
+ cd requests-$pkgver
+ python2 setup.py install --skip-build -O1 --root="$pkgdir"
+}
diff --git a/certs.patch b/certs.patch
new file mode 100644
index 000000000000..47a32f380241
--- /dev/null
+++ b/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())