[arch-commits] Commit in python-httpx/repos (4 files)

Chih-Hsuan Yen yan12125 at gemini.archlinux.org
Mon May 23 15:45:38 UTC 2022


    Date: Monday, May 23, 2022 @ 15:45:38
  Author: yan12125
Revision: 1210124

archrelease: copy trunk to community-testing-any

Added:
  python-httpx/repos/community-testing-any/
  python-httpx/repos/community-testing-any/0001-Do-not-override-the-system-SSL-certificates-with-the.patch
    (from rev 1210123, python-httpx/trunk/0001-Do-not-override-the-system-SSL-certificates-with-the.patch)
  python-httpx/repos/community-testing-any/PKGBUILD
    (from rev 1210123, python-httpx/trunk/PKGBUILD)
  python-httpx/repos/community-testing-any/uvicorn-test-server-use-h11.diff
    (from rev 1210123, python-httpx/trunk/uvicorn-test-server-use-h11.diff)

-----------------------------------------------------------------+
 0001-Do-not-override-the-system-SSL-certificates-with-the.patch |   87 ++++++++++
 PKGBUILD                                                        |   62 +++++++
 uvicorn-test-server-use-h11.diff                                |   13 +
 3 files changed, 162 insertions(+)

Copied: python-httpx/repos/community-testing-any/0001-Do-not-override-the-system-SSL-certificates-with-the.patch (from rev 1210123, python-httpx/trunk/0001-Do-not-override-the-system-SSL-certificates-with-the.patch)
===================================================================
--- community-testing-any/0001-Do-not-override-the-system-SSL-certificates-with-the.patch	                        (rev 0)
+++ community-testing-any/0001-Do-not-override-the-system-SSL-certificates-with-the.patch	2022-05-23 15:45:38 UTC (rev 1210124)
@@ -0,0 +1,87 @@
+From f2d28b9a35572134b336bcc6e347659cf0504be6 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz at archlinux.org>
+Date: Mon, 13 Jul 2020 11:29:54 -0400
+Subject: [PATCH] Do not override the system SSL certificates with the certifi
+ bundle.
+
+We need to respect the system certification policy, and by default the
+ssl module will use our packaged ca-certificates.
+
+ssl.create_default_context(cafile=None) is the default to use the
+builtin (system) certs, but due to the sorcery which this module uses to
+check how arguments are being passed, it's less invasive to simply
+hardcode the standard certificate path instead of letting python
+properly handle it.
+---
+ httpx/_config.py     | 4 +---
+ setup.py             | 1 -
+ tests/test_config.py | 5 ++---
+ 3 files changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/httpx/_config.py b/httpx/_config.py
+index 9d29f9f..1ac64e1 100644
+--- a/httpx/_config.py
++++ b/httpx/_config.py
+@@ -4,8 +4,6 @@ import typing
+ from base64 import b64encode
+ from pathlib import Path
+ 
+-import certifi
+-
+ from ._compat import set_minimum_tls_version_1_2
+ from ._models import URL, Headers
+ from ._types import CertTypes, HeaderTypes, TimeoutTypes, URLTypes, VerifyTypes
+@@ -57,7 +55,7 @@ class SSLConfig:
+     SSL Configuration.
+     """
+ 
+-    DEFAULT_CA_BUNDLE_PATH = Path(certifi.where())
++    DEFAULT_CA_BUNDLE_PATH = Path("/etc/ssl/certs/ca-certificates.crt")
+ 
+     def __init__(
+         self,
+diff --git a/setup.py b/setup.py
+index f3ada86..396d713 100644
+--- a/setup.py
++++ b/setup.py
+@@ -56,7 +56,6 @@ setup(
+     include_package_data=True,
+     zip_safe=False,
+     install_requires=[
+-        "certifi",
+         "sniffio",
+         "rfc3986[idna2008]>=1.3,<2",
+         "httpcore>=0.15.0,<0.16.0",
+diff --git a/tests/test_config.py b/tests/test_config.py
+index f218f8f..74ab743 100644
+--- a/tests/test_config.py
++++ b/tests/test_config.py
+@@ -3,7 +3,6 @@ import ssl
+ import sys
+ from pathlib import Path
+ 
+-import certifi
+ import pytest
+ 
+ import httpx
+@@ -21,7 +20,7 @@ def test_load_ssl_config_verify_non_existing_path():
+ 
+ 
+ def test_load_ssl_config_verify_existing_file():
+-    context = httpx.create_ssl_context(verify=certifi.where())
++    context = httpx.create_ssl_context(verify="/etc/ssl/certs/ca-certificates.crt")
+     assert context.verify_mode == ssl.VerifyMode.CERT_REQUIRED
+     assert context.check_hostname is True
+ 
+@@ -44,7 +43,7 @@ def test_load_ssl_config_verify_env_file(
+ 
+ 
+ def test_load_ssl_config_verify_directory():
+-    path = Path(certifi.where()).parent
++    path = Path("/etc/ssl/certs/ca-certificates.crt").parent
+     context = httpx.create_ssl_context(verify=str(path))
+     assert context.verify_mode == ssl.VerifyMode.CERT_REQUIRED
+     assert context.check_hostname is True
+-- 
+2.32.0
+

Copied: python-httpx/repos/community-testing-any/PKGBUILD (from rev 1210123, python-httpx/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD	                        (rev 0)
+++ community-testing-any/PKGBUILD	2022-05-23 15:45:38 UTC (rev 1210124)
@@ -0,0 +1,62 @@
+# Maintainer: Eli Schwartz <eschwartz at archlinux.org>
+
+_pkgname=httpx
+pkgname=python-httpx
+pkgver=0.23.0
+pkgrel=1
+pkgdesc="A next generation HTTP client for Python"
+arch=('any')
+url="https://github.com/encode/${_pkgname}"
+license=('BSD')
+depends=('python-httpcore' 'python-idna' 'python-rfc3986' 'python-sniffio')
+optdepends=(
+  'python-brotlicffi: for brotli response decompression'
+  'python-h2: HTTP/2 support'
+  'python-socksio: SOCKS proxy support'
+  'python-click: command line client support'
+  'python-rich: command line client support'
+  'python-trio: alternative async library'
+)
+makedepends=('python-setuptools')
+checkdepends=('python-pytest-asyncio' 'python-pytest-trio' 'python-typing_extensions' 'python-brotlicffi' 'python-h2' 'python-trustme' 'uvicorn' 'python-socksio'
+              'python-rich' 'python-chardet')
+source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz"
+        "0001-Do-not-override-the-system-SSL-certificates-with-the.patch"
+        "uvicorn-test-server-use-h11.diff")
+sha512sums=('3cfdf2b3b2f15967a1eec0be05ed947c5e18a46576b68a9cbfd5147dfd4736cb7c389f5431732b93f3a11f3ec6c6f25f7cbb3d96d845f00b58e2b8dae047c1d5'
+            '163665f984ef33fb8ddfdbc4d5f6fe7bec1a8c7aa5bce9acd6fc21e917ac3329ad70c2d6c642831fcc52d21ba030c072434f6492bc64ffaf143d54982fff435f'
+            'd86ec2b97ca0dda68f023f9d1fbed0cb143e4ae118ac71fe6651f8f65d7130f014c0cc14a9ab490fc09583370141d5827976c334bd1c58aaebcf1a00762214c9')
+b2sums=('036c66b2c3f743cd069716297f331f0d75043a98180b9db3e156c5692ae8bf9c68d1db87169953a7f44aaf7ee8554d0166f70b508f77b7ff4b0ebc0500bc02ad'
+        '14043504b8369655bd9a6db78f24bbffd3b687d437276d62314320b59f9b2ef09618bef27612353078cbc9554ed7c2b7e2468e2ef3a155bca35ae72b7aa1f1ee'
+        'b67493e9c8d38ae9b64d831b178d8b943a90a3382e381f08792a35c935fa702b094ea962eb653e5b6ad1b5990466d3d0814d166093aa7b9e921632e61d4ebd45')
+
+prepare() {
+  cd ${_pkgname}-${pkgver}
+
+  # bad certifi
+  patch -p1 -i ../0001-Do-not-override-the-system-SSL-certificates-with-the.patch
+  # fix tests
+  patch -Np1 -i ../uvicorn-test-server-use-h11.diff
+
+  # disable -Werror, which often causes failures due to newer dependencies in Arch
+  sed -i '/\berror\b/d' setup.cfg
+}
+
+build() {
+  cd ${_pkgname}-${pkgver}
+
+  python setup.py build
+}
+
+check() {
+  cd ${_pkgname}-${pkgver}
+
+  pytest
+}
+
+package() {
+  cd ${_pkgname}-${pkgver}
+
+  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
+  install -Dm644 LICENSE.md "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE.md
+}

Copied: python-httpx/repos/community-testing-any/uvicorn-test-server-use-h11.diff (from rev 1210123, python-httpx/trunk/uvicorn-test-server-use-h11.diff)
===================================================================
--- community-testing-any/uvicorn-test-server-use-h11.diff	                        (rev 0)
+++ community-testing-any/uvicorn-test-server-use-h11.diff	2022-05-23 15:45:38 UTC (rev 1210124)
@@ -0,0 +1,13 @@
+diff --git a/tests/conftest.py b/tests/conftest.py
+index 970c353..1ea3aa9 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -304,7 +304,7 @@ def serve_in_thread(server: Server):
+ 
+ @pytest.fixture(scope="session")
+ def server():
+-    config = Config(app=app, lifespan="off", loop="asyncio")
++    config = Config(app=app, lifespan="off", loop="asyncio", http="h11")
+     server = TestServer(config=config)
+     yield from serve_in_thread(server)
+ 



More information about the arch-commits mailing list