summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorPellegrino Prevete2023-08-28 21:01:26 +0200
committerPellegrino Prevete2023-08-28 21:01:26 +0200
commita7e1f0d2cb7e2a1e0b7bd0ad07fca0eb29eb805c (patch)
treec89fbb2df7b915230d1554546e773a17d4efae7c /PKGBUILD
parentcf84c6672355e2deea922c55c0ec09d738eda2d4 (diff)
downloadaur-python2-requests.tar.gz
update style; add LICENSE
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD101
1 files changed, 66 insertions, 35 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 0c4a6aba218a..09f4e2bd78fa 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,16 +1,19 @@
-# Maintainer: Marcell Meszaros < marcell.meszaros AT runbox.eu >
+# Maintainer: Pellegrino Prevete < pellegrinoprevete@gmail.com >
+# Contributor: Marcell Meszaros < marcell.meszaros AT runbox.eu >
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
-pkgname='python2-requests'
-_name="${pkgname#python2-}"
+_py="python2"
+_pkg="requests"
+pkgname="${_py}-${_pkg}"
+_name="${_pkg}"
_commit='fa1b0a367abc8488542f7ce7c02a3614ad8aa09d'
pkgver=2.27.1.r5.gfa1b0a36
pkgrel=1
pkgdesc='HTTP for Humans (legacy Python 2 version)'
arch=('any')
-url="https://pypi.org/project/${_name}"
-_repourl="https://github.com/psf/${_name}"
+url="https://pypi.org/project/${_pkg}"
+_repourl="https://github.com/psf/${_pkg}"
license=('Apache')
makedepends=('python2-setuptools')
_depends_that_are_checkdepends=(
@@ -20,19 +23,24 @@ _depends_that_are_checkdepends=(
'python2-urllib3'
)
_checkdepends_needed=(
- 'python2-flask'
- 'python2-pytest-mock'
- 'python2-pytest-httpbin'
-# 'python2-pytest-xdist' # optional; enables parallel testing, but unavailable
- 'python2-trustme'
+ "${_py}-flask"
+ "${_py}-pytest-mock"
+ "${_py}-pytest-httpbin"
+ # optional; enables parallel testing, but unavailable
+ # "${_py}-pytest-xdist"
+ "${_py}-trustme"
)
-optdepends=('python2-pysocks: SOCKS proxy support (deprecated)')
-optdepends+=("${_checkdepends_needed[@]/%/: needed for check() during build}")
-_tardirname="${_name}-${_commit}"
-source=("python-${_name}-${pkgver}.tar.gz::${_repourl}/archive/${_commit}.tar.gz"
- 'certs.patch')
-b2sums=('350b89ec150702b6b1ecb9faa3f20e79977620b828df20b625a422216ff33a040ab561ed07bb14663c5319802f7d37baafcb5752746faf702dd81b1dbb968fc7'
- 'b6a7c9796a8ffedebcdbf0d2f95c40b1bbfa0beb45a3c7d5b493a459c4516533992291c720cf02e291cdbbf554dd0bf25c1312f4be41e39acd586b41911ad5b0')
+optdepends=(
+ "${_py}-pysocks: SOCKS proxy support (deprecated)")
+optdepends+=(
+ "${_checkdepends_needed[@]/%/: needed for check() during build}")
+_tardirname="${_pkg}-${_commit}"
+source=(
+ "python-${_pkg}-${pkgver}.tar.gz::${_repourl}/archive/${_commit}.tar.gz"
+ 'certs.patch')
+b2sums=(
+ '350b89ec150702b6b1ecb9faa3f20e79977620b828df20b625a422216ff33a040ab561ed07bb14663c5319802f7d37baafcb5752746faf702dd81b1dbb968fc7'
+ 'b6a7c9796a8ffedebcdbf0d2f95c40b1bbfa0beb45a3c7d5b493a459c4516533992291c720cf02e291cdbbf554dd0bf25c1312f4be41e39acd586b41911ad5b0')
_checkinstalled() {
pacman --deptest $@
@@ -51,36 +59,50 @@ prepare() {
echo
echo "Patching certs.py: use Arch's default ca-certificates.crt"
- patch --verbose -p1 -i "${srcdir}/certs.patch"
+ patch --verbose \
+ -p1 \
+ -i "${srcdir}/certs.patch"
echo
echo "Changing hashbangs in *.py files to refer to 'python2'"
- sed -e '1s|#![ ]*/[a-zA-Z0-9./_ ]*python.*|#!/usr/bin/env python2|' \
+ sed -e "1s|#![ ]*/[a-zA-Z0-9./_ ]*python.*|#!/usr/bin/env ${_py}|" \
-i $(find . -name '*.py')
}
build() {
cd "${_tardirname}"
- python2 setup.py build
+ "${_py}" setup.py build
}
check() {
- ( _checkinstalled "${_checkdepends_needed[@]}" "${_depends_that_are_checkdepends[@]}" > /dev/null ) \
- || echo "Skipping testing: checkdepends not installed:"; \
- ( _checkinstalled "${_checkdepends_needed[@]}" "${_depends_that_are_checkdepends[@]}" ) || \
+ ( _checkinstalled \
+ "${_checkdepends_needed[@]}" \
+ "${_depends_that_are_checkdepends[@]}" > \
+ /dev/null ) || \
+ echo "Skipping testing: checkdepends not installed:"; \
+ ( _checkinstalled \
+ "${_checkdepends_needed[@]}" \
+ "${_depends_that_are_checkdepends[@]}" ) || \
return 0
# 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)
+ # 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 "${_tardirname}"
(
- echo '-- Using LC_ALL=C.UTF-8 locale to ensure UTF-8 filesystem encoding is used in Python 2'
+ echo '-- Using LC_ALL=C.UTF-8 locale to ensure ' \
+ 'UTF-8 filesystem encoding is used in Python 2'
- ( _checkinstalled 'python2-pysocks' > /dev/null ) \
- || echo '-- Disabling tests for python2-pysocks: not installed'; \
- export _pytest_conditional_options=(-k="not test_use_proxy_from_environment")
+ ( _checkinstalled \
+ "${_py}-pysocks" > \
+ /dev/null ) || \
+ echo '-- Disabling tests for python2-pysocks: not installed'; \
+ export \
+ _pytest_conditional_options=(
+ -k="not test_use_proxy_from_environment")
echo
export LC_ALL=C.UTF-8
@@ -88,10 +110,11 @@ check() {
export PYTHONPATH="${PWD}/build/lib:${PYTHONPATH}"
set -x
pytest2 tests \
- --verbose \
- --cache-clear \
- --deselect 'tests/test_requests.py::TestRequests::test_pyopenssl_redirect' \
- "${_pytest_conditional_options[@]}"
+ --verbose \
+ --cache-clear \
+ --deselect \
+ 'tests/test_requests.py::TestRequests::test_pyopenssl_redirect' \
+ "${_pytest_conditional_options[@]}"
)
}
@@ -101,6 +124,14 @@ package() {
"${_depends_that_are_checkdepends[@]}"
)
cd "${_tardirname}"
- python2 setup.py install --root="${pkgdir}" --prefix='/usr' --optimize=1 --skip-build
- install --verbose -Dm 644 'README.md' -t "${pkgdir}/usr/share/doc/${pkgname}"
+ python2 setup.py install --root="${pkgdir}" \
+ --prefix='/usr' \
+ --optimize=1 \
+ --skip-build
+ install --verbose \
+ -Dm 644 \
+ 'README.md' \
+ -t "${pkgdir}/usr/share/doc/${pkgname}"
}
+
+# vim:set sw=2 sts=-1 et: