diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-12-19 15:27:07 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-12-19 16:03:23 +0100 |
commit | 2346e37c55873b1674e9d43458e117863e20662d (patch) | |
tree | 6bbf142c6316b98b1bdcb61f6154bcc93632e065 /dev-python | |
parent | dev-libs/roct-thunk-interface: drop out-of-sync 9999 ebuild (diff) | |
download | gentoo-2346e37c55873b1674e9d43458e117863e20662d.tar.gz gentoo-2346e37c55873b1674e9d43458e117863e20662d.tar.bz2 gentoo-2346e37c55873b1674e9d43458e117863e20662d.zip |
dev-python/hypercorn: New package, v0.14.3
A test dependency of httpx-socks, aimed at satisfying new NIH deps
of dev-python/python-socks.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r-- | dev-python/hypercorn/Manifest | 1 | ||||
-rw-r--r-- | dev-python/hypercorn/files/hypercorn-0.14.3-tomli.patch | 106 | ||||
-rw-r--r-- | dev-python/hypercorn/hypercorn-0.14.3.ebuild | 47 | ||||
-rw-r--r-- | dev-python/hypercorn/metadata.xml | 13 |
4 files changed, 167 insertions, 0 deletions
diff --git a/dev-python/hypercorn/Manifest b/dev-python/hypercorn/Manifest new file mode 100644 index 000000000000..09c22ff73087 --- /dev/null +++ b/dev-python/hypercorn/Manifest @@ -0,0 +1 @@ +DIST hypercorn-0.14.3.gh.tar.gz 154930 BLAKE2B da827d586307ace6ef9ddb8ca4046ebc5c745df1d48152ed78b948751a7d472c73d5f8310e58266158af4739e14f2960a46c2e7fc7f12bf7629a3edb3821b58f SHA512 f0d69ab1883379058112907547e6f89a4a7114d7f4851b92f0c465d73def9cc15508e3981bda7e66ce3c00e896f7fb221b3dcd8bee6a51d8429572b678b7ade8 diff --git a/dev-python/hypercorn/files/hypercorn-0.14.3-tomli.patch b/dev-python/hypercorn/files/hypercorn-0.14.3-tomli.patch new file mode 100644 index 000000000000..a438680423a9 --- /dev/null +++ b/dev-python/hypercorn/files/hypercorn-0.14.3-tomli.patch @@ -0,0 +1,106 @@ +From 676612c73d3c231f823f88ea0995e80522db6178 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Mon, 19 Dec 2022 15:27:41 +0100 +Subject: [PATCH] Use tomllib/tomli for .toml support + +Replace the unmaintained and non-conformant `toml` library with +the built-in `tomllib` module in Python 3.11+, with fallback to `tomli` +(featuring the same ABI) in Python 3.10 and older. +--- + pyproject.toml | 2 +- + src/hypercorn/config.py | 10 +++++++--- + src/hypercorn/logging.py | 10 +++++++--- + tox.ini | 1 - + 4 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 71ceaff..1334fcf 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -30,7 +30,7 @@ h11 = "*" + h2 = ">=3.1.0" + priority = "*" + pydata_sphinx_theme = { version = "*", optional = true } +-toml = "*" ++tomli = { version = "*", python = "<3.11" } + trio = { version = ">=0.11.0", optional = true } + typing_extensions = { version = ">=3.7.4", python = "<3.8" } + uvloop = { version = "*", markers = "platform_system != 'Windows'", optional = true } +diff --git a/src/hypercorn/config.py b/src/hypercorn/config.py +index f9a9d66..ecfa1bd 100644 +--- a/src/hypercorn/config.py ++++ b/src/hypercorn/config.py +@@ -6,6 +6,7 @@ import logging + import os + import socket + import stat ++import sys + import types + import warnings + from dataclasses import dataclass +@@ -22,7 +23,10 @@ from time import time + from typing import Any, AnyStr, Dict, List, Mapping, Optional, Tuple, Type, Union + from wsgiref.handlers import format_date_time + +-import toml ++if sys.version_info >= (3, 11): ++ import tomllib ++else: ++ import tomli as tomllib + + from .logging import Logger + +@@ -355,8 +359,8 @@ class Config: + filename: The filename which gives the path to the file. + """ + file_path = os.fspath(filename) +- with open(file_path) as file_: +- data = toml.load(file_) ++ with open(file_path, "rb") as file_: ++ data = tomllib.load(file_) + return cls.from_mapping(data) + + @classmethod +diff --git a/src/hypercorn/logging.py b/src/hypercorn/logging.py +index 3c2c657..8ca6105 100644 +--- a/src/hypercorn/logging.py ++++ b/src/hypercorn/logging.py +@@ -9,7 +9,11 @@ from http import HTTPStatus + from logging.config import dictConfig, fileConfig + from typing import Any, IO, Mapping, Optional, TYPE_CHECKING, Union + +-import toml ++if sys.version_info >= (3, 11): ++ import tomllib ++else: ++ import tomli as tomllib ++ + + if TYPE_CHECKING: + from .config import Config +@@ -65,8 +69,8 @@ class Logger: + with open(config.logconfig[5:]) as file_: + dictConfig(json.load(file_)) + elif config.logconfig.startswith("toml:"): +- with open(config.logconfig[5:]) as file_: +- dictConfig(toml.load(file_)) ++ with open(config.logconfig[5:], "rb") as file_: ++ dictConfig(tomllib.load(file_)) + else: + log_config = { + "__file__": config.logconfig, +diff --git a/tox.ini b/tox.ini +index 675992b..0f636fb 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -47,7 +47,6 @@ basepython = python3.10 + deps = + mypy + pytest +- types-toml + commands = + mypy src/hypercorn/ tests/ + +-- +2.39.0 + diff --git a/dev-python/hypercorn/hypercorn-0.14.3.ebuild b/dev-python/hypercorn/hypercorn-0.14.3.ebuild new file mode 100644 index 000000000000..b63cb6151dd5 --- /dev/null +++ b/dev-python/hypercorn/hypercorn-0.14.3.ebuild @@ -0,0 +1,47 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=poetry +PYTHON_COMPAT=( pypy3 python3_{8..11} ) + +inherit distutils-r1 + +DESCRIPTION="A ASGI Server based on Hyper libraries and inspired by Gunicorn" +HOMEPAGE=" + https://github.com/pgjones/hypercorn/ + https://pypi.org/project/hypercorn/ +" +SRC_URI=" + https://github.com/pgjones/hypercorn/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + dev-python/h11[${PYTHON_USEDEP}] + >=dev-python/h2-3.1.0[${PYTHON_USEDEP}] + dev-python/priority[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + dev-python/tomli[${PYTHON_USEDEP}] + ' 3.{8..10}) + >=dev-python/wsproto-0.14.0[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/pytest-asyncio[${PYTHON_USEDEP}] + dev-python/pytest-trio[${PYTHON_USEDEP}] + dev-python/trio[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +src_prepare() { + sed -i -e 's:--no-cov-on-fail::' pyproject.toml || die + distutils-r1_src_prepare +} diff --git a/dev-python/hypercorn/metadata.xml b/dev-python/hypercorn/metadata.xml new file mode 100644 index 000000000000..1d8855d3b9ff --- /dev/null +++ b/dev-python/hypercorn/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <stabilize-allarches/> + <upstream> + <remote-id type="pypi">hypercorn</remote-id> + <remote-id type="github">pgjones/hypercorn</remote-id> + </upstream> +</pkgmetadata> |