diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2022-01-22 17:46:59 +0200 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-01-23 20:49:02 +0200 |
commit | 90301aee6c65a6b9508a984e420772e48be36b6a (patch) | |
tree | 9633246a7510abf59cff5c6e5349878874017dc3 /dev-python/black | |
parent | dev-python/myst_parser: new package, add 0.16.1_p20220119 (diff) | |
download | gentoo-90301aee6c65a6b9508a984e420772e48be36b6a.tar.gz gentoo-90301aee6c65a6b9508a984e420772e48be36b6a.tar.bz2 gentoo-90301aee6c65a6b9508a984e420772e48be36b6a.zip |
dev-python/black: up the dev-python/tomli dep cap
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python/black')
-rw-r--r-- | dev-python/black/black-21.12_beta0-r1.ebuild | 68 | ||||
-rw-r--r-- | dev-python/black/files/black-21.12_beta0-support-tomli-2.patch | 40 |
2 files changed, 108 insertions, 0 deletions
diff --git a/dev-python/black/black-21.12_beta0-r1.ebuild b/dev-python/black/black-21.12_beta0-r1.ebuild new file mode 100644 index 000000000000..240e64169926 --- /dev/null +++ b/dev-python/black/black-21.12_beta0-r1.ebuild @@ -0,0 +1,68 @@ +# Copyright 2020-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..10} ) +DISTUTILS_USE_PEP517=setuptools +inherit distutils-r1 optfeature + +MY_PV="${PV//_beta/b}" +MY_P="${PN}-${MY_PV}" + +DESCRIPTION="The uncompromising Python code formatter" +HOMEPAGE="https://black.readthedocs.io/en/stable/ https://github.com/psf/black" +SRC_URI="https://github.com/psf/${PN}/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~x64-macos" + +RDEPEND=" + >=dev-python/click-8.0.0[${PYTHON_USEDEP}] + >=dev-python/mypy_extensions-0.4.3[${PYTHON_USEDEP}] + >=dev-python/platformdirs-2[${PYTHON_USEDEP}] + <dev-python/pathspec-1[${PYTHON_USEDEP}] + <dev-python/tomli-3[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + dev-python/typing-extensions[${PYTHON_USEDEP}] + ' python3_{8,9}) +" +BDEPEND=" + dev-python/setuptools_scm[${PYTHON_USEDEP}] + dev-python/toml[${PYTHON_USEDEP}] + test? ( + >=dev-python/aiohttp-3.7.4[${PYTHON_USEDEP}] + dev-python/aiohttp-cors[${PYTHON_USEDEP}] + dev-python/colorama[${PYTHON_USEDEP}] + dev-python/parameterized[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + # Merged in master + "${FILESDIR}/${P}-support-tomli-2.patch" +) + +distutils_enable_tests pytest + +export SETUPTOOLS_SCM_PRETEND_VERSION=${MY_PV} + +src_prepare() { + # remove unnecessary bind that worked around broken 6.1.0/6.2.0 releases + sed -i -e '/setuptools_scm/s:~=:>=:' \ + -e 's/setuptools_scm\[toml\]>=[0-9.]*/setuptools_scm[toml]/' setup.cfg || die + distutils-r1_src_prepare +} + +python_test() { + cp "${S}"/src/black_primer/primer.json \ + "${BUILD_DIR}"/lib/black_primer/primer.json || die + distutils_install_for_testing + epytest -m "not python2" +} + +pkg_postinst() { + optfeature "blackd - HTTP API for black" "dev-python/aiohttp dev-python/aiohttp-cors" +} diff --git a/dev-python/black/files/black-21.12_beta0-support-tomli-2.patch b/dev-python/black/files/black-21.12_beta0-support-tomli-2.patch new file mode 100644 index 000000000000..5374dc6e82a9 --- /dev/null +++ b/dev-python/black/files/black-21.12_beta0-support-tomli-2.patch @@ -0,0 +1,40 @@ +From 389e9c23a9e622ee6090d902cc5f56c5f76cdee9 Mon Sep 17 00:00:00 2001 +From: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> +Date: Tue, 21 Dec 2021 18:03:07 +0200 +Subject: [PATCH] Disable universal newlines when reading TOML (#2408) + +--- a/Pipfile ++++ b/Pipfile +@@ -42,7 +42,7 @@ platformdirs= ">=2" + click = ">=8.0.0" + mypy_extensions = ">=0.4.3" + pathspec = ">=0.8.1" +-tomli = ">=0.2.6, <2.0.0" ++tomli = ">=1.1.0, <3.0.0" + typed-ast = "==1.4.3" + typing_extensions = {markers = "python_version < '3.10'", version = ">=3.10.0.0"} + black = {editable = true,extras = ["d"],path = "."} +--- a/setup.py ++++ b/setup.py +@@ -99,7 +99,7 @@ def find_python_files(base: Path) -> List[Path]: + install_requires=[ + "click>=7.1.2", + "platformdirs>=2", +- "tomli>=0.2.6,<2.0.0", ++ "tomli>=1.1.0,<3.0.0", + "typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'", + "pathspec>=0.9.0, <1", + "dataclasses>=0.6; python_version < '3.7'", +--- a/src/black/files.py ++++ b/src/black/files.py +@@ -95,8 +95,8 @@ def parse_pyproject_toml(path_config: str) -> Dict[str, Any]: + + If parsing fails, will raise a tomli.TOMLDecodeError + """ +- with open(path_config, encoding="utf8") as f: +- pyproject_toml = tomli.loads(f.read()) ++ with open(path_config, "rb") as f: ++ pyproject_toml = tomli.load(f) + config = pyproject_toml.get("tool", {}).get("black", {}) + return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()} + |