From b748a21cb043e89c9bf6e5b378b94edc2e95d9e5 Mon Sep 17 00:00:00 2001 From: "Liguros - Gitlab CI/CD [develop]" Date: Thu, 26 Jan 2023 12:46:38 +0000 Subject: Adding metadata --- dev-python/bandit/bandit-1.7.4-r1.ebuild | 46 ++++++ dev-python/bandit/bandit-1.7.4.ebuild | 37 ----- dev-python/bandit/files/bandit-1.7.4-tomli.patch | 85 ++++++++++ dev-python/boto3/Manifest | 1 + dev-python/boto3/boto3-1.26.57.ebuild | 68 ++++++++ dev-python/botocore/Manifest | 1 + dev-python/botocore/botocore-1.29.57.ebuild | 74 +++++++++ dev-python/braintree/Manifest | 1 + dev-python/braintree/braintree-4.18.1.ebuild | 38 +++++ .../click-option-group-0.5.5.ebuild | 13 +- dev-python/pikepdf/Manifest | 1 + dev-python/pikepdf/pikepdf-6.2.9.ebuild | 61 +++++++ .../pkgcraft-python/pkgcraft-python-0.0.3.ebuild | 2 +- .../pkgcraft-python/pkgcraft-python-9999.ebuild | 2 +- .../podman-py/files/podman-py-4.3.0-tomli.patch | 89 +++++++++++ dev-python/podman-py/podman-py-4.3.0-r1.ebuild | 54 +++++++ dev-python/podman-py/podman-py-4.3.0.ebuild | 48 ------ .../files/python-lsp-black-1.2.1-tomli.patch | 94 +++++++++++ .../python-lsp-black-1.2.1-r1.ebuild | 42 +++++ .../python-lsp-black/python-lsp-black-1.2.1.ebuild | 36 ----- dev-python/tox/Manifest | 2 +- dev-python/tox/tox-4.3.4.ebuild | 86 ---------- dev-python/tox/tox-4.4.2.ebuild | 95 +++++++++++ dev-python/yapf/Manifest | 2 +- dev-python/yapf/files/yapf-0.32.0-tomli.patch | 178 +++++++++++++++++++++ dev-python/yapf/yapf-0.32.0-r1.ebuild | 40 +++++ dev-python/yapf/yapf-0.32.0.ebuild | 25 --- 27 files changed, 980 insertions(+), 241 deletions(-) create mode 100644 dev-python/bandit/bandit-1.7.4-r1.ebuild delete mode 100644 dev-python/bandit/bandit-1.7.4.ebuild create mode 100644 dev-python/bandit/files/bandit-1.7.4-tomli.patch create mode 100644 dev-python/boto3/boto3-1.26.57.ebuild create mode 100644 dev-python/botocore/botocore-1.29.57.ebuild create mode 100644 dev-python/braintree/braintree-4.18.1.ebuild create mode 100644 dev-python/pikepdf/pikepdf-6.2.9.ebuild create mode 100644 dev-python/podman-py/files/podman-py-4.3.0-tomli.patch create mode 100644 dev-python/podman-py/podman-py-4.3.0-r1.ebuild delete mode 100644 dev-python/podman-py/podman-py-4.3.0.ebuild create mode 100644 dev-python/python-lsp-black/files/python-lsp-black-1.2.1-tomli.patch create mode 100644 dev-python/python-lsp-black/python-lsp-black-1.2.1-r1.ebuild delete mode 100644 dev-python/python-lsp-black/python-lsp-black-1.2.1.ebuild delete mode 100644 dev-python/tox/tox-4.3.4.ebuild create mode 100644 dev-python/tox/tox-4.4.2.ebuild create mode 100644 dev-python/yapf/files/yapf-0.32.0-tomli.patch create mode 100644 dev-python/yapf/yapf-0.32.0-r1.ebuild delete mode 100644 dev-python/yapf/yapf-0.32.0.ebuild (limited to 'dev-python') diff --git a/dev-python/bandit/bandit-1.7.4-r1.ebuild b/dev-python/bandit/bandit-1.7.4-r1.ebuild new file mode 100644 index 000000000000..8c2071986a8c --- /dev/null +++ b/dev-python/bandit/bandit-1.7.4-r1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{7,8,9,10,11} ) + +inherit distutils-r1 + +DESCRIPTION="A security linter from OpenStack Security" +HOMEPAGE=" + https://github.com/PyCQA/bandit/ + https://pypi.org/project/bandit/ +" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64 ~arm arm64 ~riscv x86" + +RDEPEND=" + >=dev-python/pbr-2.0.0[${PYTHON_USEDEP}] + >=dev-python/GitPython-1.0.1[${PYTHON_USEDEP}] + >=dev-python/pyyaml-5.3.1[${PYTHON_USEDEP}] + >=dev-python/stevedore-1.20.0[${PYTHON_USEDEP}] +" +BDEPEND=" + >=dev-python/pbr-2.0.0[${PYTHON_USEDEP}] + test? ( + >=dev-python/fixtures-3.0.0[${PYTHON_USEDEP}] + >=dev-python/testscenarios-0.5.0[${PYTHON_USEDEP}] + >=dev-python/testtools-2.3.0[${PYTHON_USEDEP}] + >=dev-python/beautifulsoup4-4.8.0[${PYTHON_USEDEP}] + >=dev-python/pylint-1.9.4[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + dev-python/tomli[${PYTHON_USEDEP}] + ' 3.{8..10}) + ) +" + +distutils_enable_tests unittest + +PATCHES=( + "${FILESDIR}"/${P}-tomli.patch +) diff --git a/dev-python/bandit/bandit-1.7.4.ebuild b/dev-python/bandit/bandit-1.7.4.ebuild deleted file mode 100644 index 65133fb1e813..000000000000 --- a/dev-python/bandit/bandit-1.7.4.ebuild +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{7,8,9,10,11} ) - -inherit distutils-r1 - -DESCRIPTION="A security linter from OpenStack Security" -HOMEPAGE="https://github.com/PyCQA/bandit" -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="amd64 ~arm arm64 ~riscv x86" - -RDEPEND=" - >=dev-python/pbr-2.0.0[${PYTHON_USEDEP}] - >=dev-python/GitPython-1.0.1[${PYTHON_USEDEP}] - >=dev-python/pyyaml-5.3.1[${PYTHON_USEDEP}] - >=dev-python/stevedore-1.20.0[${PYTHON_USEDEP}] -" -BDEPEND=" - >=dev-python/pbr-2.0.0[${PYTHON_USEDEP}] - test? ( - >=dev-python/fixtures-3.0.0[${PYTHON_USEDEP}] - >=dev-python/testscenarios-0.5.0[${PYTHON_USEDEP}] - >=dev-python/testtools-2.3.0[${PYTHON_USEDEP}] - >=dev-python/beautifulsoup4-4.8.0[${PYTHON_USEDEP}] - >=dev-python/pylint-1.9.4[${PYTHON_USEDEP}] - dev-python/toml[${PYTHON_USEDEP}] - ) -" - -distutils_enable_tests unittest diff --git a/dev-python/bandit/files/bandit-1.7.4-tomli.patch b/dev-python/bandit/files/bandit-1.7.4-tomli.patch new file mode 100644 index 000000000000..238cc1f6d352 --- /dev/null +++ b/dev-python/bandit/files/bandit-1.7.4-tomli.patch @@ -0,0 +1,85 @@ +From 5a8f1050011a6eeca96c1b8a0fe1988fda97f214 Mon Sep 17 00:00:00 2001 +From: Mathieu Kniewallner +Date: Fri, 25 Mar 2022 23:27:56 +0100 +Subject: [PATCH] Replace `toml` with `tomli` (#829) + +* Replace `toml` with `tomli` + +* Only require `tomli` on Python < 3.11 + +* Update test-requirements.txt + +Co-authored-by: Eric Brown +--- + bandit/core/config.py | 20 ++++++++++++-------- + setup.cfg | 2 +- + test-requirements.txt | 2 +- + 3 files changed, 14 insertions(+), 10 deletions(-) + +diff --git a/bandit/core/config.py b/bandit/core/config.py +index 7c259bcc..236f357c 100644 +--- a/bandit/core/config.py ++++ b/bandit/core/config.py +@@ -3,13 +3,17 @@ + # + # SPDX-License-Identifier: Apache-2.0 + import logging ++import sys + + import yaml + +-try: +- import toml +-except ImportError: +- toml = None ++if sys.version_info >= (3, 11): ++ import tomllib ++else: ++ try: ++ import tomli as tomllib ++ except ImportError: ++ tomllib = None + + from bandit.core import constants + from bandit.core import extension_loader +@@ -34,14 +38,14 @@ def __init__(self, config_file=None): + + if config_file: + try: +- f = open(config_file) ++ f = open(config_file, "rb") + except OSError: + raise utils.ConfigError( + "Could not read config file.", config_file + ) + + if config_file.endswith(".toml"): +- if toml is None: ++ if tomllib is None: + raise utils.ConfigError( + "toml parser not available, reinstall with toml extra", + config_file, +@@ -49,8 +53,8 @@ def __init__(self, config_file=None): + + try: + with f: +- self._config = toml.load(f)["tool"]["bandit"] +- except toml.TomlDecodeError as err: ++ self._config = tomllib.load(f)["tool"]["bandit"] ++ except tomllib.TOMLDecodeError as err: + LOG.error(err) + raise utils.ConfigError("Error parsing file.", config_file) + else: +diff --git a/setup.cfg b/setup.cfg +index 5d570eea..7449f15b 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -31,7 +31,7 @@ project_urls = + yaml = + PyYAML + toml = +- toml ++ tomli>=1.1.0; python_version < "3.11" + + [entry_points] + console_scripts = diff --git a/dev-python/boto3/Manifest b/dev-python/boto3/Manifest index 91d78d76d61b..5f4281dae5eb 100644 --- a/dev-python/boto3/Manifest +++ b/dev-python/boto3/Manifest @@ -5,3 +5,4 @@ DIST boto3-1.26.53.gh.tar.gz 592023 BLAKE2B 07f09144913b7506dcb790e9a72adacecafd DIST boto3-1.26.54.gh.tar.gz 592401 BLAKE2B 7fd5bb10cda2b27fc43a7efa65c4651d95c8ddb7c94b424847f21010f9d748398a9efc47118ed7d2d90369664dddd4903fb8c4e7bc3ba3f70643a565b426023f SHA512 86d315eba84d783d327d19b41a593f193d9b356a205f29a1589e43e43519aa6eedefc26e7b23234dade6ab0bbb309d8039b011d0ba766757be8eb7a57c22f49b DIST boto3-1.26.55.gh.tar.gz 592495 BLAKE2B 3e187731eb2eefafb349709df589ee7001f234059a9d68a4170fd3643e1eaa8528b6f6b89d32a239375ff792df93dd675b8effcbd18b8167de23aea313ac87a1 SHA512 59eec6c16e7010cadd11235806204c50b353d9ec101595ad6838ea72407d55849854aa68da088a94a2e56802d3caeec8fb1d5a432ed360c20edce1fff44ff273 DIST boto3-1.26.56.gh.tar.gz 592747 BLAKE2B d74dbfc691212267b6c755a853e80fd6affec257f89e79626646d0b75f3b96a95e8b39924eb7ec9a091b59102f016ef26a33cfbec8c2e19b28216677cce1adfe SHA512 61bb273c64b5adbbb8eb67636719b92c270636d533a64f2531ec40d266afb0dc31c261b7bb38aa98b42121a70d7226d282b8041c638dcb0e2907d803a37c0b3c +DIST boto3-1.26.57.gh.tar.gz 593947 BLAKE2B 5a30f237d992bb766b3afaced8b9e01c792c857a02aee5ba589f0f03c4c8eace3b32920d1dd62554fbb85d14b7f96789590d4acbc764dd3c56208fa5bf2dea1d SHA512 112719584ad122373e5aa24ebb6ea5c87772cdab71f59274b2f2172d92c72ed6894645253e15e12a808a83e14b12d27fde8a9fe086ccc33b987166de3fe0984b diff --git a/dev-python/boto3/boto3-1.26.57.ebuild b/dev-python/boto3/boto3-1.26.57.ebuild new file mode 100644 index 000000000000..9523f65d5fb9 --- /dev/null +++ b/dev-python/boto3/boto3-1.26.57.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..11} ) + +inherit distutils-r1 multiprocessing + +DESCRIPTION="The AWS SDK for Python" +HOMEPAGE=" + https://github.com/boto/boto3/ + https://pypi.org/project/boto3/ +" +LICENSE="Apache-2.0" +SLOT="0" + +if [[ "${PV}" == "9999" ]]; then + EGIT_REPO_URI="https://github.com/boto/boto3" + inherit git-r3 + BOTOCORE_PV=${PV} +else + SRC_URI=" + https://github.com/boto/boto3/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz + " + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" + + # botocore is x.(y+3).z + BOTOCORE_PV="$(ver_cut 1).$(( $(ver_cut 2) + 3)).$(ver_cut 3-)" +fi + +RDEPEND=" + >=dev-python/botocore-${BOTOCORE_PV}[${PYTHON_USEDEP}] + >=dev-python/jmespath-0.7.1[${PYTHON_USEDEP}] + >=dev-python/s3transfer-0.6.0[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/mock[${PYTHON_USEDEP}] + dev-python/pytest-xdist[${PYTHON_USEDEP}] + ) +" + +distutils_enable_sphinx docs/source \ + 'dev-python/guzzle_sphinx_theme' +distutils_enable_tests pytest + +python_prepare_all() { + # don't lock versions to narrow ranges + sed -e '/botocore/ d' \ + -e '/jmespath/ d' \ + -e '/s3transfer/ d' \ + -i setup.py || die + + # do not rely on bundled deps in botocore (sic!) + find -name '*.py' -exec sed -i \ + -e 's:from botocore[.]vendored import:import:' \ + -e 's:from botocore[.]vendored[.]:from :' \ + {} + || die + + distutils-r1_python_prepare_all +} + +python_test() { + epytest tests/{functional,unit} -n "$(makeopts_jobs)" +} diff --git a/dev-python/botocore/Manifest b/dev-python/botocore/Manifest index 21aa4130bd82..415b91c2fecf 100644 --- a/dev-python/botocore/Manifest +++ b/dev-python/botocore/Manifest @@ -5,3 +5,4 @@ DIST botocore-1.29.53.gh.tar.gz 11124794 BLAKE2B 0d5fd0a4e9ffb0d077cf740df604b1f DIST botocore-1.29.54.gh.tar.gz 11127081 BLAKE2B 7c2d11d968ca6a4d3b23b12c44cb8f050ac1848f75280c44bbb2f3567860204ed8615bd1596e02b8d0222f4d54c22a8559114365ec6a69e4a01a166a821d8c8a SHA512 4ba58c9b881ff95149ba1a5805453885208cdb68f197cc9a6c13cc9ca075e988ae33e4809f2970d9c48fa426e26c06d83686b8bbf4ff69d4a7cfe26ef3f903bf DIST botocore-1.29.55.gh.tar.gz 11128407 BLAKE2B 182c39bc0e1b40a5ef8cd4bbb87243972282a6cfcfea7d1b6830790c8b759c67e6cad18e93d7a56224efa0d97b96edc06853f1df12a22c11a694beb677e75880 SHA512 02fc018e313b9ee4c2c745343bf8977a5311cd9264fc1186cbf19610d1ca8224f362b29432f7a2676fe85d03b1102e7e2736f4933ba564784f0e61832f3989a6 DIST botocore-1.29.56.gh.tar.gz 11128363 BLAKE2B fd6a416e822294ef5ba2e33e7a1bdde026031721d54185514845651e196957a2a17cb9cfba1ff0c6766cdcb47697d27898796586f9144cc5116ec13b818dd911 SHA512 a452d10560432b0fc96ffa9db0e716e57c71b522c9cccdc852087240ddfee22005e7f553be0618c0319d5404d9627e1ccd8682320d8d3f03d78bf41ae8c913be +DIST botocore-1.29.57.gh.tar.gz 11132049 BLAKE2B 748a8b709cb6bff1a1bb38757ad68c31aa680589ed59e7c3f73b6563a5b9572ace96102ffda56643d33f0dee98f30f8443a431c7869ccfe54a311964ce781b5b SHA512 adbd760b8238b259bcc1eb3ba42cdb702b60eb6fece73a5bda5129a974826655157e702cef6a1114c2e3bd036b1cf22ebbead6e78bf88129fe68b02de1f38dae diff --git a/dev-python/botocore/botocore-1.29.57.ebuild b/dev-python/botocore/botocore-1.29.57.ebuild new file mode 100644 index 000000000000..0f4daaa48e81 --- /dev/null +++ b/dev-python/botocore/botocore-1.29.57.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..11} ) + +inherit distutils-r1 multiprocessing + +DESCRIPTION="Low-level, data-driven core of boto 3" +HOMEPAGE=" + https://github.com/boto/botocore/ + https://pypi.org/project/botocore/ +" +LICENSE="Apache-2.0" +SLOT="0" + +if [[ "${PV}" == "9999" ]]; then + EGIT_REPO_URI="https://github.com/boto/botocore" + inherit git-r3 +else + SRC_URI=" + https://github.com/boto/botocore/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz + " + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" +fi + +RDEPEND=" + dev-python/six[${PYTHON_USEDEP}] + =dev-python/urllib3-1.25.4[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/jsonschema[${PYTHON_USEDEP}] + dev-python/pytest-xdist[${PYTHON_USEDEP}] + ) +" + +distutils_enable_sphinx docs/source \ + 'dev-python/guzzle_sphinx_theme' +distutils_enable_tests pytest + +src_prepare() { + # unpin deps + sed -i -e "s:>=.*':':" setup.py || die + + # unbundle deps + rm -r botocore/vendored || die + find -name '*.py' -exec sed -i \ + -e 's:from botocore[.]vendored import:import:' \ + -e 's:from botocore[.]vendored[.]:from :' \ + {} + || die + + distutils-r1_src_prepare +} + +python_test() { + local EPYTEST_DESELECT=( + # rely on bundled six + tests/functional/test_six_imports.py::test_no_bare_six_imports + tests/functional/test_six_threading.py::test_six_thread_safety + # fails on unrelated warnings + tests/unit/test_client.py::TestAutoGeneratedClient::test_BOTO_DISABLE_COMMONNAME + tests/unit/test_client.py::TestClientErrors::test_BOTO_DISABLE_COMMONNAME + # TODO + tests/functional/test_credentials.py::SSOSessionTest::test_token_chosen_from_provider + ) + + epytest tests/{functional,unit} -n "$(makeopts_jobs)" +} diff --git a/dev-python/braintree/Manifest b/dev-python/braintree/Manifest index 19dca452bea2..82156bf04b19 100644 --- a/dev-python/braintree/Manifest +++ b/dev-python/braintree/Manifest @@ -1 +1,2 @@ DIST braintree_python-4.18.0.gh.tar.gz 216422 BLAKE2B 30ed072c3f6c6ae3cc9661fe5a1f49327ad2fd17261590a61aaae543966a40c9018a1c3b789e1ba3f387a8d93cff35c8b7ffd589e76ffefc572b7dc9fcd84951 SHA512 2abdec5e16386bed5e9c6d1d085ec604050907a57bf9dbe65c6c3d05b2bdf8f00929e11729b50a4774ab2bdd61a1a8d4a73f6c23368b663cc5757562b8ce1e4f +DIST braintree_python-4.18.1.gh.tar.gz 216743 BLAKE2B 715656ac712d6b79200c4453ca5ff35bf803ddaa04f57e174ebbc3f61776b3d373184ed82781349f0ea5205c8e7cedff701e6d254ff3b821be06b77c39352946 SHA512 7adb1f5e66113d663dc59cfc1df638c3bcdfc2f1ed46125b3e882ee48053e2ea07139f447cc4151dde6a7afb6986cb65d41f26a116d00a89e5f28d54409b9fcb diff --git a/dev-python/braintree/braintree-4.18.1.ebuild b/dev-python/braintree/braintree-4.18.1.ebuild new file mode 100644 index 000000000000..498a6426f033 --- /dev/null +++ b/dev-python/braintree/braintree-4.18.1.ebuild @@ -0,0 +1,38 @@ +# Copyright 2020-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{7,8,9,10,11} ) + +inherit distutils-r1 + +MY_P=braintree_python-${PV} +DESCRIPTION="Braintree Python Library" +HOMEPAGE=" + https://developer.paypal.com/braintree/docs/reference/overview/ + https://github.com/braintree/braintree_python/ + https://pypi.org/project/braintree/ +" +SRC_URI=" + https://github.com/braintree/braintree_python/archive/${PV}.tar.gz + -> ${MY_P}.gh.tar.gz +" +S=${WORKDIR}/${MY_P} + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND=" + >=dev-python/requests-0.11.1[${PYTHON_USEDEP}] +" + +DOCS=( README.md ) + +distutils_enable_tests unittest + +python_test() { + eunittest tests/unit +} diff --git a/dev-python/click-option-group/click-option-group-0.5.5.ebuild b/dev-python/click-option-group/click-option-group-0.5.5.ebuild index d4ac04a23622..38e42ccaea44 100644 --- a/dev-python/click-option-group/click-option-group-0.5.5.ebuild +++ b/dev-python/click-option-group/click-option-group-0.5.5.ebuild @@ -15,15 +15,18 @@ SRC_URI="https://github.com/click-contrib/${PN}/archive/v${PV}.tar.gz -> ${P}.gh LICENSE="BSD" SLOT="0" KEYWORDS="~amd64" +RESTRICT="test" RDEPEND="dev-python/click[${PYTHON_USEDEP}]" DEPEND="${RDEPEND}" BDEPEND=" - test? ( - dev-python/pytest-cov[${PYTHON_USEDEP}] - +Date: Fri, 14 Oct 2022 13:54:31 +0200 +Subject: [PATCH] Use modern tomllib/tomli modules for reading TOML files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Replace the unmaintained `toml`/`pytoml` dependencies with the modern +alternatives: the built-in `tomllib` module in Python 3.11, and `tomli` +in older Python versions. Preserving backwards compatibility does not +seem necessary, as podman-py no longer supports Python versions older +than 3.6. + +Signed-off-by: Michał Górny +--- + podman/domain/config.py | 16 ++++++++++------ + pyproject.toml | 2 +- + python-podman.spec.rpkg | 8 ++++---- + requirements.txt | 2 +- + setup.cfg | 2 +- + 5 files changed, 17 insertions(+), 13 deletions(-) + +diff --git a/podman/domain/config.py b/podman/domain/config.py +index 555ed9d..6ea8eb6 100644 +--- a/podman/domain/config.py ++++ b/podman/domain/config.py +@@ -1,17 +1,21 @@ + """Read containers.conf file.""" ++import sys + import urllib + from pathlib import Path + from typing import Dict, Optional + + import xdg.BaseDirectory + +-try: +- import toml +-except ImportError: +- import pytoml as toml +- + from podman.api import cached_property + ++if sys.version_info >= (3, 11): ++ from tomllib import loads as toml_loads ++else: ++ try: ++ from tomli import loads as toml_loads ++ except ImportError: ++ from toml import loads as toml_loads ++ + + class ServiceConnection: + """ServiceConnection defines a connection to the Podman service.""" +@@ -64,7 +68,7 @@ def __init__(self, path: Optional[str] = None): + if self.path.exists(): + with self.path.open(encoding='utf-8') as file: + buffer = file.read() +- self.attrs = toml.loads(buffer) ++ self.attrs = toml_loads(buffer) + + def __hash__(self) -> int: + return hash(tuple(self.path.name)) +diff --git a/pyproject.toml b/pyproject.toml +index f3cdfb9..3b29ecb 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -25,7 +25,7 @@ requires = [ + "requests>=2.24", + "setuptools>=46.4", + "sphinx", +- "toml>=0.10.2", ++ "tomli>=1.2.3; python_version<'3.11'", + "urllib3>=1.24.2", + "wheel", + ] +diff --git a/setup.cfg b/setup.cfg +index f8d1b6f..2066951 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -36,7 +36,7 @@ test_suite = + install_requires = + pyxdg>=0.26 + requests>=2.24 +- toml>=0.10.2 ++ tomli>=1.2.3; python_version<'3.11' + urllib3>=1.24.2 + + # typing_extensions are included for RHEL 8.5 diff --git a/dev-python/podman-py/podman-py-4.3.0-r1.ebuild b/dev-python/podman-py/podman-py-4.3.0-r1.ebuild new file mode 100644 index 000000000000..f8de9729c97d --- /dev/null +++ b/dev-python/podman-py/podman-py-4.3.0-r1.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{7,8,9,10,11} ) + +inherit distutils-r1 + +DESCRIPTION="A library to interact with a Podman server" +HOMEPAGE=" + https://github.com/containers/podman-py/ + https://pypi.org/project/podman/ +" +SRC_URI=" + https://github.com/containers/podman-py/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + >=dev-python/pyxdg-0.26[${PYTHON_USEDEP}] + >=dev-python/requests-2.24[${PYTHON_USEDEP}] + >=dev-python/urllib3-1.24.2[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + >=dev-python/tomli-1.2.3[${PYTHON_USEDEP}] + ' 3.{8..10}) +" +BDEPEND=" + test? ( + dev-python/requests-mock[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/${P}-tomli.patch +) + +python_test() { + local EPYTEST_DESELECT=( + # TODO + podman/tests/unit/test_volumesmanager.py::VolumesManagerTestCase::test_get_404 + ) + + # integration tests require a workable podman server, + # and it doesn't seem to work in ebuild env + epytest podman/tests/unit +} diff --git a/dev-python/podman-py/podman-py-4.3.0.ebuild b/dev-python/podman-py/podman-py-4.3.0.ebuild deleted file mode 100644 index be495c36f954..000000000000 --- a/dev-python/podman-py/podman-py-4.3.0.ebuild +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{7,8,9,10,11} ) - -inherit distutils-r1 - -DESCRIPTION="A library to interact with a Podman server" -HOMEPAGE=" - https://github.com/containers/podman-py/ - https://pypi.org/project/podman/ -" -SRC_URI=" - https://github.com/containers/podman-py/archive/v${PV}.tar.gz - -> ${P}.gh.tar.gz -" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="~amd64" - -RDEPEND=" - >=dev-python/pyxdg-0.26[${PYTHON_USEDEP}] - >=dev-python/requests-2.24[${PYTHON_USEDEP}] - >=dev-python/toml-0.10.2[${PYTHON_USEDEP}] - >=dev-python/urllib3-1.24.2[${PYTHON_USEDEP}] -" -BDEPEND=" - test? ( - dev-python/requests-mock[${PYTHON_USEDEP}] - ) -" - -distutils_enable_tests pytest - -python_test() { - local EPYTEST_DESELECT=( - # TODO - podman/tests/unit/test_volumesmanager.py::VolumesManagerTestCase::test_get_404 - ) - - # integration tests require a workable podman server, - # and it doesn't seem to work in ebuild env - epytest podman/tests/unit -} diff --git a/dev-python/python-lsp-black/files/python-lsp-black-1.2.1-tomli.patch b/dev-python/python-lsp-black/files/python-lsp-black-1.2.1-tomli.patch new file mode 100644 index 000000000000..8ecef0287f40 --- /dev/null +++ b/dev-python/python-lsp-black/files/python-lsp-black-1.2.1-tomli.patch @@ -0,0 +1,94 @@ +From 80d34ca4f35baa654e5f1fee7860214950f1ae37 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Thu, 26 Jan 2023 12:07:11 +0100 +Subject: [PATCH] Replace the obsolete toml package with tomllib/tomli + +Use the modern `tomllib` module (in Python 3.11+) or its drop-in +replacement `tomli` (for older Python versions) instead of the obsolete +`toml` module. The latter is unmaintained and does not support TOML +1.0. +--- + .pre-commit-config.yaml | 2 +- + pylsp_black/plugin.py | 12 +++++++++--- + setup.cfg | 7 +++++-- + 3 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml +index 304770e..d5bd147 100644 +--- a/.pre-commit-config.yaml ++++ b/.pre-commit-config.yaml +@@ -17,7 +17,7 @@ repos: + rev: v0.942 + hooks: + - id: mypy +- additional_dependencies: [black, types-pkg_resources, types-setuptools, types-toml] ++ additional_dependencies: [black, types-pkg_resources, types-setuptools] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: +diff --git a/pylsp_black/plugin.py b/pylsp_black/plugin.py +index f013171..090b1b0 100644 +--- a/pylsp_black/plugin.py ++++ b/pylsp_black/plugin.py +@@ -1,15 +1,20 @@ + import logging + import os ++import sys + from functools import lru_cache + from pathlib import Path + from typing import Dict, Optional + + import black +-import toml + from pylsp import hookimpl + from pylsp._utils import get_eol_chars + from pylsp.config.config import Config + ++if sys.version_info >= (3, 11): ++ import tomllib ++else: ++ import tomli as tomllib ++ + logger = logging.getLogger(__name__) + + +@@ -154,8 +159,9 @@ def _load_config(filename: str, client_config: Config) -> Dict: + return defaults + + try: +- pyproject_toml = toml.load(str(pyproject_filename)) +- except (toml.TomlDecodeError, OSError): ++ with open(pyproject_filename, "rb") as f: ++ pyproject_toml = tomllib.load(f) ++ except (tomllib.TOMLDecodeError, OSError): + logger.warning( + "Error decoding pyproject.toml, using defaults: %r", + defaults, +diff --git a/setup.cfg b/setup.cfg +index 47510d5..257add6 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -18,7 +18,10 @@ classifiers = + + [options] + packages = find: +-install_requires = python-lsp-server>=1.4.0; black>=22.3.0; toml ++install_requires = ++ python-lsp-server>=1.4.0 ++ black>=22.3.0 ++ tomli; python_version<'3.11' + python_requires = >= 3.7 + + [options.entry_points] +@@ -26,7 +29,7 @@ pylsp = pylsp_black = pylsp_black.plugin + + [options.extras_require] + # add any types-* packages to .pre-commit-config.yaml mypy additional_dependencies +-dev = isort>=5.0; flake8; pre-commit; pytest; mypy; pytest; types-pkg_resources; types-setuptools; types-toml ++dev = isort>=5.0; flake8; pre-commit; pytest; mypy; pytest; types-pkg_resources; types-setuptools + + [flake8] + max-line-length = 88 +-- +2.39.1 + diff --git a/dev-python/python-lsp-black/python-lsp-black-1.2.1-r1.ebuild b/dev-python/python-lsp-black/python-lsp-black-1.2.1-r1.ebuild new file mode 100644 index 000000000000..83c34c83088a --- /dev/null +++ b/dev-python/python-lsp-black/python-lsp-black-1.2.1-r1.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{7,8,9,10,11} ) + +inherit distutils-r1 + +DESCRIPTION="Black plugin for the Python LSP Server" +HOMEPAGE=" + https://github.com/python-lsp/python-lsp-black/ + https://pypi.org/project/python-lsp-black/ +" +SRC_URI=" + https://github.com/python-lsp/${PN}/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="amd64 x86" + +RDEPEND=" + >=dev-python/python-lsp-server-1.4.0[${PYTHON_USEDEP}] + >=dev-python/black-22.3.0[${PYTHON_USEDEP}] +" + +BDEPEND=" + test? ( + $(python_gen_cond_dep ' + dev-python/tomli[${PYTHON_USEDEP}] + ' 3.{8..10}) + ) +" + +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/${P}-tomli.patch +) diff --git a/dev-python/python-lsp-black/python-lsp-black-1.2.1.ebuild b/dev-python/python-lsp-black/python-lsp-black-1.2.1.ebuild deleted file mode 100644 index 8bcf85eb7ea0..000000000000 --- a/dev-python/python-lsp-black/python-lsp-black-1.2.1.ebuild +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{7,8,9,10,11} ) - -inherit distutils-r1 - -DESCRIPTION="Black plugin for the Python LSP Server" -HOMEPAGE=" - https://github.com/python-lsp/python-lsp-black/ - https://pypi.org/project/python-lsp-black/ -" -SRC_URI=" - https://github.com/python-lsp/${PN}/archive/v${PV}.tar.gz - -> ${P}.gh.tar.gz -" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="amd64 x86" - -RDEPEND=" - >=dev-python/python-lsp-server-1.4.0[${PYTHON_USEDEP}] - >=dev-python/black-22.3.0[${PYTHON_USEDEP}] -" - -BDEPEND=" - test? ( - dev-python/toml[${PYTHON_USEDEP}] - ) -" - -distutils_enable_tests pytest diff --git a/dev-python/tox/Manifest b/dev-python/tox/Manifest index 0eb33319479f..3e22d1282d06 100644 --- a/dev-python/tox/Manifest +++ b/dev-python/tox/Manifest @@ -1,3 +1,3 @@ DIST tox-3.28.0.gh.tar.gz 309472 BLAKE2B 9896411426f6aebb3efa468c01696ecc5f17ec3e67825672d0efc74c1b1468bc8b8d9c14b6177c181750ba4b9a5e77d616068dd83e21f5641acfc8e2a271cc1f SHA512 64816754e6800661bb564c5c7d21c4139522d540a04fafe3c4591d596072d48d1cbe0ee2abee9c8faf3d5007774f5371431b5a7a8f49912bc879c7b168aab2ca -DIST tox-4.3.4.gh.tar.gz 298487 BLAKE2B d1b36e537cdc8309c550b664e8543ae06329d713fe2267ce2c7082c57c597155b4d1764baedf58c2ce762570a4988bb293ec5e74829e722163dd0d00ed13f558 SHA512 288d7867131009229acfcd3fb78fdc60e0f4de933a64c1a91600cbcee496eb5787e24b43705815705b7d1fe6a4d19f4987571d9a237292d6e7216bd63c235444 DIST tox-4.3.5.gh.tar.gz 298866 BLAKE2B 86f6d76d2600f6acc3ac02f0998e818acf053991b3a2e89c3c206d36a32f1427f14ba2e5524124172a353c51d4fab8dfd7161b0d2d437f80cfc7b554befcc91c SHA512 18347306857c616801fc0975dff94fcd5097dc16741a0fdd0c885d4f43bbc8620a419b53fd8a5c97b8f80220ba6a2d3911e42b42c767233260337152784b732b +DIST tox-4.4.2.gh.tar.gz 303341 BLAKE2B 812394e15996b04138e2a8167b3d332b48217c5ecfb807d8ed77ff106d8ad31cfc6b43e07737dec39e1deba7165aa7778471894823b0dbe795b1ccddd2396602 SHA512 1e5b8f025c93bea5b9071d5cfcb4e4e68f1925e7b70c4c838b9f4ba70f8f077ed752176c2a7349b96d125842312c4fa8ccbd23d79665ba46667f4b408bf58f78 diff --git a/dev-python/tox/tox-4.3.4.ebuild b/dev-python/tox/tox-4.3.4.ebuild deleted file mode 100644 index 49cec2e60351..000000000000 --- a/dev-python/tox/tox-4.3.4.ebuild +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=hatchling -PYTHON_COMPAT=( python3_{7,8,9,10,11} pypy3 ) - -inherit distutils-r1 - -MY_P=${P/_} -DESCRIPTION="virtualenv-based automation of test activities" -HOMEPAGE=" - https://tox.readthedocs.io/ - https://github.com/tox-dev/tox/ - https://pypi.org/project/tox/ -" -SRC_URI=" - https://github.com/tox-dev/tox/archive/${PV/_}.tar.gz - -> ${MY_P}.gh.tar.gz -" -S=${WORKDIR}/${MY_P} - -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64 ~ppc ~ppc64 ~riscv" - -RDEPEND=" - >=dev-python/cachetools-5.2.1[${PYTHON_USEDEP}] - >=dev-python/chardet-5.1[${PYTHON_USEDEP}] - >=dev-python/colorama-0.4.6[${PYTHON_USEDEP}] - >=dev-python/filelock-3.8.2[${PYTHON_USEDEP}] - >=dev-python/packaging-21.3[${PYTHON_USEDEP}] - >=dev-python/platformdirs-2.6[${PYTHON_USEDEP}] - >=dev-python/pluggy-1[${PYTHON_USEDEP}] - >=dev-python/pyproject-api-1.4[${PYTHON_USEDEP}] - $(python_gen_cond_dep ' - >=dev-python/tomli-2.0.1[${PYTHON_USEDEP}] - ' 3.8 3.9 3.10) - >=dev-python/virtualenv-20.17.1[${PYTHON_USEDEP}] -" -BDEPEND=" - >=dev-python/hatch-vcs-0.3[${PYTHON_USEDEP}] - test? ( - dev-python/build[${PYTHON_USEDEP}] - >=dev-python/distlib-0.3.6[${PYTHON_USEDEP}] - >=dev-python/flaky-3.7[${PYTHON_USEDEP}] - >=dev-python/psutil-5.9.4[${PYTHON_USEDEP}] - dev-python/pytest-mock[${PYTHON_USEDEP}] - >=dev-python/pytest-xdist-3.1[${PYTHON_USEDEP}] - >=dev-python/re-assert-1.1[${PYTHON_USEDEP}] - $(python_gen_cond_dep ' - >=dev-python/time-machine-2.8.2[${PYTHON_USEDEP}] - ' 'python*') - ) -" - -distutils_enable_tests pytest - -export SETUPTOOLS_SCM_PRETEND_VERSION=${PV} - -src_prepare() { - # the minimal bounds in tox are entirely meaningless and new packaging - # breaks setuptools - sed -i -e '/packaging/s:>=[0-9]\+::' pyproject.toml || die - distutils-r1_src_prepare -} - -python_test() { - # devpi_process is not packaged, and has lots of dependencies - cat > "${T}"/devpi_process.py <<-EOF || die - def IndexServer(*args, **kwargs): raise NotImplementedError() - EOF - - local -x PYTHONPATH=${T}:${PYTHONPATH} - local EPYTEST_DESELECT=( - # Internet - tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py::test_build_wheel_external - ) - local EPYTEST_IGNORE=( - # requires devpi* - tests/test_provision.py - ) - - epytest -} diff --git a/dev-python/tox/tox-4.4.2.ebuild b/dev-python/tox/tox-4.4.2.ebuild new file mode 100644 index 000000000000..549abf66f6cd --- /dev/null +++ b/dev-python/tox/tox-4.4.2.ebuild @@ -0,0 +1,95 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=hatchling +PYTHON_COMPAT=( python3_{7,8,9,10,11} pypy3 ) + +inherit distutils-r1 + +MY_P=${P/_} +DESCRIPTION="virtualenv-based automation of test activities" +HOMEPAGE=" + https://tox.readthedocs.io/ + https://github.com/tox-dev/tox/ + https://pypi.org/project/tox/ +" +SRC_URI=" + https://github.com/tox-dev/tox/archive/${PV/_}.tar.gz + -> ${MY_P}.gh.tar.gz +" +S=${WORKDIR}/${MY_P} + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~ppc64 ~riscv" + +RDEPEND=" + >=dev-python/cachetools-5.2.1[${PYTHON_USEDEP}] + >=dev-python/chardet-5.1[${PYTHON_USEDEP}] + >=dev-python/colorama-0.4.6[${PYTHON_USEDEP}] + >=dev-python/filelock-3.8.2[${PYTHON_USEDEP}] + >=dev-python/packaging-21.3[${PYTHON_USEDEP}] + >=dev-python/platformdirs-2.6[${PYTHON_USEDEP}] + >=dev-python/pluggy-1[${PYTHON_USEDEP}] + >=dev-python/pyproject-api-1.5[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + >=dev-python/tomli-2.0.1[${PYTHON_USEDEP}] + ' 3.8 3.9 3.10) + >=dev-python/virtualenv-20.17.1[${PYTHON_USEDEP}] +" +BDEPEND=" + >=dev-python/hatch-vcs-0.3[${PYTHON_USEDEP}] + test? ( + dev-python/build[${PYTHON_USEDEP}] + >=dev-python/distlib-0.3.6[${PYTHON_USEDEP}] + >=dev-python/flaky-3.7[${PYTHON_USEDEP}] + >=dev-python/psutil-5.9.4[${PYTHON_USEDEP}] + dev-python/pytest-mock[${PYTHON_USEDEP}] + >=dev-python/pytest-xdist-3.1[${PYTHON_USEDEP}] + >=dev-python/re-assert-1.1[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + >=dev-python/time-machine-2.8.2[${PYTHON_USEDEP}] + ' 'python*') + ) +" + +distutils_enable_tests pytest + +export SETUPTOOLS_SCM_PRETEND_VERSION=${PV} + +src_prepare() { + # the minimal bounds in tox are entirely meaningless and new packaging + # breaks setuptools + sed -i -e '/packaging/s:>=[0-9]\+::' pyproject.toml || die + distutils-r1_src_prepare +} + +python_test() { + # devpi_process is not packaged, and has lots of dependencies + cat > "${T}"/devpi_process.py <<-EOF || die + def IndexServer(*args, **kwargs): raise NotImplementedError() + EOF + + local -x PYTHONPATH=${T}:${PYTHONPATH} + local EPYTEST_DESELECT=( + # Internet + tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py::test_build_wheel_external + ) + local EPYTEST_IGNORE=( + # requires devpi* + tests/test_provision.py + ) + + [[ ${EPYTHON} == pypy3 ]] && EPYTEST_DESELECT+=( + 'tests/tox_env/python/pip/test_pip_install.py::test_constrain_package_deps[explicit-True-True]' + 'tests/tox_env/python/pip/test_pip_install.py::test_constrain_package_deps[requirements-True-True]' + 'tests/tox_env/python/pip/test_pip_install.py::test_constrain_package_deps[constraints-True-True]' + 'tests/tox_env/python/pip/test_pip_install.py::test_constrain_package_deps[explicit+requirements-True-True]' + 'tests/tox_env/python/pip/test_pip_install.py::test_constrain_package_deps[requirements_indirect-True-True]' + 'tests/tox_env/python/pip/test_pip_install.py::test_constrain_package_deps[requirements_constraints_indirect-True-True]' + ) + + epytest +} diff --git a/dev-python/yapf/Manifest b/dev-python/yapf/Manifest index 9dd78a39089f..36aac5ba5a5a 100644 --- a/dev-python/yapf/Manifest +++ b/dev-python/yapf/Manifest @@ -1 +1 @@ -DIST yapf-0.32.0.tar.gz 178621 BLAKE2B b2132e3fffb96113700e322bba3f49ded0fe417de901522793564d5830951e9f2017c576fb89c5e423f4f547c95659040c2a4fc923887d9fb941e219b21f0cf6 SHA512 c1a05a04f7558a5b51899c29010bedc105c4a4bad4b5358a903a22a39f451e03369d2b4e670ecb44a857a8fef2bf438d9da0afcbdd3a336cf037bbf480d19878 +DIST yapf-0.32.0.gh.tar.gz 178621 BLAKE2B b2132e3fffb96113700e322bba3f49ded0fe417de901522793564d5830951e9f2017c576fb89c5e423f4f547c95659040c2a4fc923887d9fb941e219b21f0cf6 SHA512 c1a05a04f7558a5b51899c29010bedc105c4a4bad4b5358a903a22a39f451e03369d2b4e670ecb44a857a8fef2bf438d9da0afcbdd3a336cf037bbf480d19878 diff --git a/dev-python/yapf/files/yapf-0.32.0-tomli.patch b/dev-python/yapf/files/yapf-0.32.0-tomli.patch new file mode 100644 index 000000000000..bdbfd96112a2 --- /dev/null +++ b/dev-python/yapf/files/yapf-0.32.0-tomli.patch @@ -0,0 +1,178 @@ +From 5909ba87f79ea1d687e5836c62dc82a116f4229f Mon Sep 17 00:00:00 2001 +From: Eric McDonald <221418+emcd@users.noreply.github.com> +Date: Wed, 30 Nov 2022 14:23:50 -0800 +Subject: [PATCH] Prevent crashes against valid 'pyproject.toml'. (#1040) + +* Replace 'toml' dependency with 'tomli', which fully supports TOML 1. + +Co-authored-by: Eric McDonald +--- + setup.py | 2 +- + yapf/yapflib/file_resources.py | 15 ++++++++------- + yapf/yapflib/style.py | 25 ++++++++++++++----------- + yapftests/file_resources_test.py | 10 +++++----- + yapftests/style_test.py | 4 ++-- + 5 files changed, 30 insertions(+), 26 deletions(-) + +diff --git a/yapf/yapflib/file_resources.py b/yapf/yapflib/file_resources.py +index b5e2612b..6809ca9f 100644 +--- a/yapf/yapflib/file_resources.py ++++ b/yapf/yapflib/file_resources.py +@@ -49,14 +49,15 @@ def _GetExcludePatternsFromPyprojectToml(filename): + """Get a list of file patterns to ignore from pyproject.toml.""" + ignore_patterns = [] + try: +- import toml ++ import tomli as tomllib + except ImportError: + raise errors.YapfError( +- "toml package is needed for using pyproject.toml as a " ++ "tomli package is needed for using pyproject.toml as a " + "configuration file") + + if os.path.isfile(filename) and os.access(filename, os.R_OK): +- pyproject_toml = toml.load(filename) ++ with open(filename, 'rb') as fd: ++ pyproject_toml = tomllib.load(fd) + ignore_patterns = pyproject_toml.get('tool', + {}).get('yapfignore', + {}).get('ignore_patterns', []) +@@ -127,19 +128,19 @@ def GetDefaultStyleForDir(dirname, default_style=style.DEFAULT_STYLE): + # See if we have a pyproject.toml file with a '[tool.yapf]' section. + config_file = os.path.join(dirname, style.PYPROJECT_TOML) + try: +- fd = open(config_file) ++ fd = open(config_file, 'rb') + except IOError: + pass # It's okay if it's not there. + else: + with fd: + try: +- import toml ++ import tomli as tomllib + except ImportError: + raise errors.YapfError( +- "toml package is needed for using pyproject.toml as a " ++ "tomli package is needed for using pyproject.toml as a " + "configuration file") + +- pyproject_toml = toml.load(config_file) ++ pyproject_toml = tomllib.load(fd) + style_dict = pyproject_toml.get('tool', {}).get('yapf', None) + if style_dict is not None: + return config_file +diff --git a/yapf/yapflib/style.py b/yapf/yapflib/style.py +index 233a64e6..c8397b32 100644 +--- a/yapf/yapflib/style.py ++++ b/yapf/yapflib/style.py +@@ -746,17 +746,18 @@ def _CreateConfigParserFromConfigFile(config_filename): + # Provide a more meaningful error here. + raise StyleConfigError( + '"{0}" is not a valid style or file path'.format(config_filename)) +- with open(config_filename) as style_file: +- config = py3compat.ConfigParser() +- if config_filename.endswith(PYPROJECT_TOML): +- try: +- import toml +- except ImportError: +- raise errors.YapfError( +- "toml package is needed for using pyproject.toml as a " +- "configuration file") +- +- pyproject_toml = toml.load(style_file) ++ config = py3compat.ConfigParser() ++ ++ if config_filename.endswith(PYPROJECT_TOML): ++ try: ++ import tomli as tomllib ++ except ImportError: ++ raise errors.YapfError( ++ "tomli package is needed for using pyproject.toml as a " ++ "configuration file") ++ ++ with open(config_filename, 'rb') as style_file: ++ pyproject_toml = tomllib.load(style_file) + style_dict = pyproject_toml.get("tool", {}).get("yapf", None) + if style_dict is None: + raise StyleConfigError( +@@ -766,7 +767,9 @@ def _CreateConfigParserFromConfigFile(config_filename): + config.set('style', k, str(v)) + return config + ++ with open(config_filename) as style_file: + config.read_file(style_file) ++ + if config_filename.endswith(SETUP_CONFIG): + if not config.has_section('yapf'): + raise StyleConfigError( +diff --git a/yapftests/file_resources_test.py b/yapftests/file_resources_test.py +index 31184c4a..f54f393d 100644 +--- a/yapftests/file_resources_test.py ++++ b/yapftests/file_resources_test.py +@@ -75,7 +75,7 @@ def test_get_exclude_file_patterns_from_yapfignore_with_wrong_syntax(self): + + def test_get_exclude_file_patterns_from_pyproject(self): + try: +- import toml ++ import tomli + except ImportError: + return + local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml') +@@ -93,7 +93,7 @@ def test_get_exclude_file_patterns_from_pyproject(self): + @unittest.skipUnless(py3compat.PY36, 'Requires Python 3.6') + def test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax(self): + try: +- import toml ++ import tomli + except ImportError: + return + local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml') +@@ -109,7 +109,7 @@ def test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax(self): + + def test_get_exclude_file_patterns_from_pyproject_no_ignore_section(self): + try: +- import toml ++ import tomli + except ImportError: + return + local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml') +@@ -122,7 +122,7 @@ def test_get_exclude_file_patterns_from_pyproject_no_ignore_section(self): + + def test_get_exclude_file_patterns_from_pyproject_ignore_section_empty(self): + try: +- import toml ++ import tomli + except ImportError: + return + local_ignore_file = os.path.join(self.test_tmpdir, 'pyproject.toml') +@@ -192,7 +192,7 @@ def test_setup_config(self): + def test_pyproject_toml(self): + # An empty pyproject.toml file should not be used + try: +- import toml ++ import tomli + except ImportError: + return + +diff --git a/yapftests/style_test.py b/yapftests/style_test.py +index 8a37f953..d2203d9a 100644 +--- a/yapftests/style_test.py ++++ b/yapftests/style_test.py +@@ -230,7 +230,7 @@ def testErrorUnknownStyleOption(self): + + def testPyprojectTomlNoYapfSection(self): + try: +- import toml ++ import tomli + except ImportError: + return + +@@ -242,7 +242,7 @@ def testPyprojectTomlNoYapfSection(self): + + def testPyprojectTomlParseYapfSection(self): + try: +- import toml ++ import tomli + except ImportError: + return + diff --git a/dev-python/yapf/yapf-0.32.0-r1.ebuild b/dev-python/yapf/yapf-0.32.0-r1.ebuild new file mode 100644 index 000000000000..3b8b8cc0b7e4 --- /dev/null +++ b/dev-python/yapf/yapf-0.32.0-r1.ebuild @@ -0,0 +1,40 @@ +# Copyright 2018-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{7,8,9,10,11} ) + +inherit distutils-r1 + +DESCRIPTION="A formatter for Python files" +HOMEPAGE=" + https://github.com/google/yapf/ + https://pypi.org/project/yapf/ +" +SRC_URI=" + https://github.com/google/yapf/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="amd64 ~arm64 x86" +IUSE="test" +RESTRICT="!test? ( test )" + +BDEPEND=" + test? ( + dev-python/tomli[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + "${FILESDIR}"/${P}-tomli.patch +) + +python_test() { + "${EPYTHON}" -m unittest discover -v -p '*_test.py' || + die "Tests failed with ${EPYTHON}" +} diff --git a/dev-python/yapf/yapf-0.32.0.ebuild b/dev-python/yapf/yapf-0.32.0.ebuild deleted file mode 100644 index e5649088fb36..000000000000 --- a/dev-python/yapf/yapf-0.32.0.ebuild +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2018-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{7,8,9,10,11} ) -inherit distutils-r1 - -DESCRIPTION="A formatter for Python files" -HOMEPAGE="https://github.com/google/yapf" -SRC_URI="https://github.com/google/yapf/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="amd64 ~arm64 x86" -IUSE="test" -RESTRICT="!test? ( test )" - -BDEPEND=" - test? ( dev-python/toml[${PYTHON_USEDEP}] )" - -python_test() { - "${EPYTHON}" -m unittest discover -v -p '*_test.py' || - die "Tests failed with ${EPYTHON}" -} -- cgit v1.3