public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pylama/, dev-python/pylama/files/
@ 2023-01-26 14:33 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2023-01-26 14:33 UTC (permalink / raw
  To: gentoo-commits

commit:     aa8da0c8d86b04859bf4f3f944bffbef1b772914
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 26 14:32:54 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jan 26 14:33:21 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa8da0c8

dev-python/pylama: Port to tomllib/tomli

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pylama/files/pylama-8.4.1-tomli.patch   | 69 ++++++++++++++++++++++
 ...{pylama-8.4.1.ebuild => pylama-8.4.1-r1.ebuild} | 18 +++++-
 2 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/dev-python/pylama/files/pylama-8.4.1-tomli.patch b/dev-python/pylama/files/pylama-8.4.1-tomli.patch
new file mode 100644
index 000000000000..291bc9f530e7
--- /dev/null
+++ b/dev-python/pylama/files/pylama-8.4.1-tomli.patch
@@ -0,0 +1,69 @@
+From 8b7908fec960a05af0a0a9b10d24ed458fcf97c7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 8 Nov 2022 14:33:59 +0100
+Subject: [PATCH] Use tomli/tomllib instead of the unmaintained toml package
+
+Replace the use of the unmaintained `toml` package with the modern
+alternatives: the built-in `tomllib` in Python 3.11+, and its equivalent
+`tomli` in older Python versions.  `tomli` installs type stubs, so there
+is no need for an additional `types-*` package for it.
+---
+ pylama/config_toml.py               | 9 +++++++--
+ requirements/requirements-tests.txt | 3 +--
+ setup.py                            | 2 +-
+ 3 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/pylama/config_toml.py b/pylama/config_toml.py
+index 2af02a5..ea6e17a 100644
+--- a/pylama/config_toml.py
++++ b/pylama/config_toml.py
+@@ -1,16 +1,21 @@
+ """Pylama TOML configuration."""
+ 
+-import toml
++import sys
+ 
+ from pylama.libs.inirama import Namespace as _Namespace
+ 
++if sys.version_info >= (3, 11):
++    import tomllib
++else:
++    import tomli as tomllib
++
+ 
+ class Namespace(_Namespace):
+     """Inirama-style wrapper for TOML config."""
+ 
+     def parse(self, source: str, update: bool = True, **params):
+         """Parse TOML source as string."""
+-        content = toml.loads(source)
++        content = tomllib.loads(source)
+         tool = content.get("tool", {})
+         pylama = tool.get("pylama", {})
+         linters = pylama.pop("linter", {})
+diff --git a/requirements/requirements-tests.txt b/requirements/requirements-tests.txt
+index d786f1f..e62ccae 100644
+--- a/requirements/requirements-tests.txt
++++ b/requirements/requirements-tests.txt
+@@ -5,8 +5,7 @@ radon       >= 5.1.0
+ mypy
+ pylint      >= 2.11.1
+ pylama-quotes
+-toml
++tomli       >= 1.2.3  ; python_version < "3.11"
+ vulture
+ 
+ types-setuptools
+-types-toml
+diff --git a/setup.py b/setup.py
+index 911aea6..6d0222b 100644
+--- a/setup.py
++++ b/setup.py
+@@ -21,6 +21,6 @@ def parse_requirements(path: str) -> "list[str]":
+     extras_require=dict(
+         tests=parse_requirements("requirements/requirements-tests.txt"),
+         all=OPTIONAL_LINTERS, **{linter: [linter] for linter in OPTIONAL_LINTERS},
+-        toml="toml>=0.10.2",
++        toml="tomli>=1.2.3; python_version < '3.11'",
+     ),
+ )

diff --git a/dev-python/pylama/pylama-8.4.1.ebuild b/dev-python/pylama/pylama-8.4.1-r1.ebuild
similarity index 75%
rename from dev-python/pylama/pylama-8.4.1.ebuild
rename to dev-python/pylama/pylama-8.4.1-r1.ebuild
index 0d21af8a8555..c1a76432c6e9 100644
--- a/dev-python/pylama/pylama-8.4.1.ebuild
+++ b/dev-python/pylama/pylama-8.4.1-r1.ebuild
@@ -9,8 +9,14 @@ PYTHON_COMPAT=( python3_{9..11} )
 inherit distutils-r1
 
 DESCRIPTION="Code audit tool for python"
-HOMEPAGE="https://github.com/klen/pylama"
-SRC_URI="https://github.com/klen/pylama/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
+HOMEPAGE="
+	https://github.com/klen/pylama/
+	https://pypi.org/project/pylama/
+"
+SRC_URI="
+	https://github.com/klen/pylama/archive/${PV}.tar.gz
+		-> ${P}.gh.tar.gz
+"
 
 LICENSE="MIT"
 SLOT="0"
@@ -28,13 +34,19 @@ BDEPEND="
 		dev-python/mypy[${PYTHON_USEDEP}]
 		dev-python/pylint[${PYTHON_USEDEP}]
 		dev-python/radon[${PYTHON_USEDEP}]
-		dev-python/toml[${PYTHON_USEDEP}]
 		dev-vcs/git
+		$(python_gen_cond_dep '
+			dev-python/tomli[${PYTHON_USEDEP}]
+		' 3.{8..10})
 	)
 "
 
 distutils_enable_tests pytest
 
+PATCHES=(
+	"${FILESDIR}"/${P}-tomli.patch
+)
+
 EPYTEST_DESELECT=(
 	# not packaged
 	tests/test_linters.py::test_quotes


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/pylama/, dev-python/pylama/files/
@ 2023-10-14 22:10 Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2023-10-14 22:10 UTC (permalink / raw
  To: gentoo-commits

commit:     0b3b0734f01cfd7e400d0a5ee1939e861961dc4c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 14 22:06:09 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct 14 22:10:37 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b3b0734

dev-python/pylama: Fix test_pylint elif bug 893838

Closes: https://bugs.gentoo.org/893838
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 .../pylama/files/pylama-8.4.1-dummy-elif.patch     | 32 ++++++++++++++++++++++
 dev-python/pylama/pylama-8.4.1-r1.ebuild           |  1 +
 2 files changed, 33 insertions(+)

diff --git a/dev-python/pylama/files/pylama-8.4.1-dummy-elif.patch b/dev-python/pylama/files/pylama-8.4.1-dummy-elif.patch
new file mode 100644
index 000000000000..788d38382114
--- /dev/null
+++ b/dev-python/pylama/files/pylama-8.4.1-dummy-elif.patch
@@ -0,0 +1,32 @@
+From 2093ce0ad405e20efa3f2dad771a04577e0f7e6b Mon Sep 17 00:00:00 2001
+From: Stanislav Levin <slev@altlinux.org>
+Date: Fri, 12 May 2023 19:38:41 +0300
+Subject: [PATCH] tests: Sync pylint's no-else-return
+
+https://github.com/klen/pylama/pull/243
+
+See https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/no-else-return.html for details.
+
+Fixes: https://github.com/klen/pylama/issues/238
+Signed-off-by: Stanislav Levin <slev@altlinux.org>
+---
+ dummy.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/dummy.py b/dummy.py
+index c19ee6d..09a0e3c 100644
+--- a/dummy.py
++++ b/dummy.py
+@@ -22,10 +22,10 @@ def __init__(self, filename, loc, use_column=True):
+         if test == 1:
+             if test == 1:
+                 return 28
+-            elif test == 2:
++            if test == 2:
+                 return 28
+             return 28
+-        elif test == 2:
++        if test == 2:
+             return 28
+ 
+     def __str__(self):

diff --git a/dev-python/pylama/pylama-8.4.1-r1.ebuild b/dev-python/pylama/pylama-8.4.1-r1.ebuild
index c1a76432c6e9..30c5ca59c22f 100644
--- a/dev-python/pylama/pylama-8.4.1-r1.ebuild
+++ b/dev-python/pylama/pylama-8.4.1-r1.ebuild
@@ -45,6 +45,7 @@ distutils_enable_tests pytest
 
 PATCHES=(
 	"${FILESDIR}"/${P}-tomli.patch
+	"${FILESDIR}"/${P}-dummy-elif.patch
 )
 
 EPYTEST_DESELECT=(


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-14 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-14 22:10 [gentoo-commits] repo/gentoo:master commit in: dev-python/pylama/, dev-python/pylama/files/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2023-01-26 14:33 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox