Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pydocstyle/files/, dev-python/pydocstyle/
Date: Tue, 03 Jan 2023 06:23:51
Message-Id: 1672727020.b7aeaf6d8ea3a794c8e394416a120609c1890ab7.mgorny@gentoo
1 commit: b7aeaf6d8ea3a794c8e394416a120609c1890ab7
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 3 06:04:03 2023 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 3 06:23:40 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7aeaf6d
7
8 dev-python/pydocstyle: Bump to 6.2.0
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pydocstyle/Manifest | 1 +
13 .../pydocstyle/files/pydocstyle-6.2.0-tomli.patch | 91 ++++++++++++++++++++++
14 dev-python/pydocstyle/pydocstyle-6.2.0.ebuild | 49 ++++++++++++
15 3 files changed, 141 insertions(+)
16
17 diff --git a/dev-python/pydocstyle/Manifest b/dev-python/pydocstyle/Manifest
18 index 70448015989d..716834b1a5bb 100644
19 --- a/dev-python/pydocstyle/Manifest
20 +++ b/dev-python/pydocstyle/Manifest
21 @@ -1 +1,2 @@
22 DIST pydocstyle-6.1.1.tar.gz 73982 BLAKE2B 6a896221fdcd257f0475472e1cf87ef892d8292a4c0faf661595adb17e2d18f4a8277cda498197309d34597c448203856c272256277a7e35fba20e2e5ba47f2b SHA512 ce4932a6601c80d05a46600f5af7df54798025a5f3dc41ab8cf1bc0d63e7f78b70cccb17dc99ddab25eda9abd639f91468fca1b1ceb4539708350212e481a156
23 +DIST pydocstyle-6.2.0.gh.tar.gz 77296 BLAKE2B 22f6d8691763b6c3e41bca7d0ef5193a282189f442072089aebb6d96d2e039e971e9e5645e50f4bcb8433f36cdf0e33c956c4ac381f2e7e649d010d63f5db501 SHA512 382c74d22072337a624ac635d95c9cf5fbbd373c11c85b6302c56bf21f099ebc4dd8eec2f896a8c02d4548524078daebbceef7c4fb055dfb6a6eadab0e42a190
24
25 diff --git a/dev-python/pydocstyle/files/pydocstyle-6.2.0-tomli.patch b/dev-python/pydocstyle/files/pydocstyle-6.2.0-tomli.patch
26 new file mode 100644
27 index 000000000000..f7600d1973bb
28 --- /dev/null
29 +++ b/dev-python/pydocstyle/files/pydocstyle-6.2.0-tomli.patch
30 @@ -0,0 +1,91 @@
31 +From b45a393b2f0c4ce0f17c3e58cf5d768bd653e155 Mon Sep 17 00:00:00 2001
32 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
33 +Date: Tue, 3 Jan 2023 06:49:32 +0100
34 +Subject: [PATCH] Use tomllib/tomli for reading .toml configs
35 +
36 +Use the built-in `tomllib` module in Python 3.11 and the modern `tomli`
37 +package in older Python versions to read .toml configs instead of
38 +the unmaintained and broken `toml` package.
39 +
40 +Fixes #599
41 +Fixes #600
42 +---
43 + docs/release_notes.rst | 7 +++++++
44 + poetry.lock | 16 ++++++++--------
45 + pyproject.toml | 4 ++--
46 + requirements/runtime.txt | 2 +-
47 + requirements/tests.txt | 1 -
48 + src/pydocstyle/config.py | 20 ++++++++++++--------
49 + 6 files changed, 30 insertions(+), 20 deletions(-)
50 +
51 +diff --git a/pyproject.toml b/pyproject.toml
52 +index 607aa3f..84bfe0d 100644
53 +--- a/pyproject.toml
54 ++++ b/pyproject.toml
55 +@@ -21,11 +21,11 @@ classifiers = [
56 + [tool.poetry.dependencies]
57 + python = ">=3.6"
58 + snowballstemmer = ">=2.2.0"
59 +-toml = {version = ">=0.10.2", optional = true}
60 ++tomli = {version = ">=1.2.3", optional = true, python = "<3.11"}
61 + importlib-metadata = {version = ">=2.0.0,<5.0.0", python = "<3.8"}
62 +
63 + [tool.poetry.extras]
64 +-toml = ["toml"]
65 ++toml = ["tomli"]
66 +
67 + [tool.poetry.scripts]
68 + pydocstyle = "pydocstyle.cli:main"
69 +diff --git a/src/pydocstyle/config.py b/src/pydocstyle/config.py
70 +index 4819cde..c05f7dc 100644
71 +--- a/src/pydocstyle/config.py
72 ++++ b/src/pydocstyle/config.py
73 +@@ -4,6 +4,7 @@ import copy
74 + import itertools
75 + import operator
76 + import os
77 ++import sys
78 + from collections import namedtuple
79 + from collections.abc import Set
80 + from configparser import NoOptionError, NoSectionError, RawConfigParser
81 +@@ -14,10 +15,13 @@ from ._version import __version__
82 + from .utils import log
83 + from .violations import ErrorRegistry, conventions
84 +
85 +-try:
86 +- import toml
87 +-except ImportError: # pragma: no cover
88 +- toml = None # type: ignore
89 ++if sys.version_info >= (3, 11):
90 ++ import tomllib
91 ++else:
92 ++ try:
93 ++ import tomli as tomllib
94 ++ except ImportError: # pragma: no cover
95 ++ tomllib = None # type: ignore
96 +
97 +
98 + def check_initialized(method):
99 +@@ -60,15 +64,15 @@ class TomlParser:
100 + read_ok = []
101 + for filename in filenames:
102 + try:
103 +- with open(filename, encoding=encoding) as fp:
104 +- if not toml:
105 ++ with open(filename, "rb") as fp:
106 ++ if not tomllib:
107 + log.warning(
108 + "The %s configuration file was ignored, "
109 +- "because the `toml` package is not installed.",
110 ++ "because the `tomli` package is not installed.",
111 + filename,
112 + )
113 + continue
114 +- self._config.update(toml.load(fp))
115 ++ self._config.update(tomllib.load(fp))
116 + except OSError:
117 + continue
118 + if isinstance(filename, os.PathLike):
119 +--
120 +2.39.0
121 +
122
123 diff --git a/dev-python/pydocstyle/pydocstyle-6.2.0.ebuild b/dev-python/pydocstyle/pydocstyle-6.2.0.ebuild
124 new file mode 100644
125 index 000000000000..ae9b07a98370
126 --- /dev/null
127 +++ b/dev-python/pydocstyle/pydocstyle-6.2.0.ebuild
128 @@ -0,0 +1,49 @@
129 +# Copyright 1999-2023 Gentoo Authors
130 +# Distributed under the terms of the GNU General Public License v2
131 +
132 +EAPI=8
133 +
134 +DISTUTILS_USE_PEP517=poetry
135 +PYTHON_COMPAT=( pypy3 python3_{8..11} )
136 +
137 +inherit distutils-r1
138 +
139 +DESCRIPTION="Python docstring style checker"
140 +HOMEPAGE="
141 + https://github.com/PyCQA/pydocstyle/
142 + https://pypi.org/project/pydocstyle/
143 +"
144 +SRC_URI="
145 + https://github.com/PyCQA/pydocstyle/archive/${PV}.tar.gz
146 + -> ${P}.gh.tar.gz
147 +"
148 +
149 +LICENSE="MIT"
150 +SLOT="0"
151 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
152 +
153 +RDEPEND="
154 + >=dev-python/snowballstemmer-2.2.0[${PYTHON_USEDEP}]
155 +"
156 +BDEPEND="
157 + test? (
158 + $(python_gen_cond_dep '
159 + dev-python/tomli[${PYTHON_USEDEP}]
160 + ' 3.{8..10})
161 + )
162 +"
163 +
164 +distutils_enable_tests pytest
165 +# Requires network to lookup github issues
166 +#distutils_enable_sphinx docs dev-python/sphinx_rtd_theme dev-python/sphinxcontrib-issuetracker
167 +
168 +PATCHES=(
169 + "${FILESDIR}"/pydocstyle-6.1.1-disarm-pip-install.patch
170 + "${FILESDIR}"/${P}-tomli.patch
171 +)
172 +
173 +src_prepare() {
174 + # poetry sucks
175 + sed -i -e "s:0.0.0-dev:${PV}:" pyproject.toml || die
176 + distutils-r1_src_prepare
177 +}