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

commit:     d9106ef568e17f248306bc6bf63471c19beb4612
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 24 15:54:23 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Nov 24 15:56:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9106ef5

dev-python/colorlog: Fix running tests with NO_COLOR=1

Closes: https://bugs.gentoo.org/906700
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/colorlog/colorlog-6.7.0.ebuild          | 11 ++++++--
 .../colorlog/files/colorlog-6.7.0-nocolor.patch    | 31 ++++++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/dev-python/colorlog/colorlog-6.7.0.ebuild b/dev-python/colorlog/colorlog-6.7.0.ebuild
index deeab2c63621..4457b3c16990 100644
--- a/dev-python/colorlog/colorlog-6.7.0.ebuild
+++ b/dev-python/colorlog/colorlog-6.7.0.ebuild
@@ -5,14 +5,21 @@ EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( pypy3 python3_{10..12} )
+
 inherit distutils-r1 pypi
 
 DESCRIPTION="Log formatting with colors"
-HOMEPAGE="https://pypi.org/project/colorlog/
-	https://github.com/borntyping/python-colorlog"
+HOMEPAGE="
+	https://pypi.org/project/colorlog/
+	https://github.com/borntyping/python-colorlog/
+"
 
 LICENSE="MIT"
 SLOT="0"
 KEYWORDS="amd64 ~arm64 ~riscv x86"
 
 distutils_enable_tests pytest
+
+PATCHES=(
+	"${FILESDIR}/${P}-nocolor.patch"
+)

diff --git a/dev-python/colorlog/files/colorlog-6.7.0-nocolor.patch b/dev-python/colorlog/files/colorlog-6.7.0-nocolor.patch
new file mode 100644
index 000000000000..cbd799a2f0d7
--- /dev/null
+++ b/dev-python/colorlog/files/colorlog-6.7.0-nocolor.patch
@@ -0,0 +1,31 @@
+From 4babdb5f18bd4799c25d61f0f7937b5e164770cc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 24 Nov 2023 16:45:42 +0100
+Subject: [PATCH] Fix running tests in environment with NO_COLOR=1
+
+Fix running the test suite when pytest is run with NO_COLOR=1 set
+in the environment.  An fixture is autoused to ensure that the variables
+are removed for the scope of the test, while they are respected
+e.g. by pytest itself.
+---
+ colorlog/tests/conftest.py | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/colorlog/tests/conftest.py b/colorlog/tests/conftest.py
+index 65fd6d4..33e23e6 100644
+--- a/colorlog/tests/conftest.py
++++ b/colorlog/tests/conftest.py
+@@ -28,6 +28,13 @@ def assert_log_message(capsys, log_function, message, *args):
+     return err
+ 
+ 
++@pytest.fixture(autouse=True)
++def clean_env(monkeypatch):
++    monkeypatch.delenv("FORCE_COLOR", raising=False)
++    monkeypatch.delenv("NO_COLOR", raising=False)
++    yield
++
++
+ @pytest.fixture()
+ def reset_loggers():
+     logging.root.handlers = list()


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

* [gentoo-commits] repo/gentoo:master commit in: dev-python/colorlog/, dev-python/colorlog/files/
@ 2024-06-14 15:55 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2024-06-14 15:55 UTC (permalink / raw
  To: gentoo-commits

commit:     b5a730b27d9b4619f0e1ec958533de7049dc2a78
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 14 15:29:36 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jun 14 15:54:49 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5a730b2

dev-python/colorlog: Enable py3.13

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

 dev-python/colorlog/colorlog-6.8.2.ebuild          |  7 ++-
 .../colorlog/files/colorlog-6.8.2-py313.patch      | 51 ++++++++++++++++++++++
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/dev-python/colorlog/colorlog-6.8.2.ebuild b/dev-python/colorlog/colorlog-6.8.2.ebuild
index 1bb20db7b6a8..d75db15a6ab3 100644
--- a/dev-python/colorlog/colorlog-6.8.2.ebuild
+++ b/dev-python/colorlog/colorlog-6.8.2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( pypy3 python3_{10..12} )
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
 
 inherit distutils-r1 pypi
 
@@ -19,3 +19,8 @@ SLOT="0"
 KEYWORDS="amd64 arm64 ~loong ~riscv x86"
 
 distutils_enable_tests pytest
+
+PATCHES=(
+	# https://github.com/borntyping/python-colorlog/commit/607485def2d60b60c40c0d682574324b47fc30ba
+	"${FILESDIR}/${P}-py313.patch"
+)

diff --git a/dev-python/colorlog/files/colorlog-6.8.2-py313.patch b/dev-python/colorlog/files/colorlog-6.8.2-py313.patch
new file mode 100644
index 000000000000..dc47fe2ee534
--- /dev/null
+++ b/dev-python/colorlog/files/colorlog-6.8.2-py313.patch
@@ -0,0 +1,51 @@
+From 607485def2d60b60c40c0d682574324b47fc30ba Mon Sep 17 00:00:00 2001
+From: Sam Clements <sam@borntyping.co.uk>
+Date: Fri, 26 Jan 2024 14:06:47 +0000
+Subject: [PATCH] Support Python 3.13
+
+---
+ colorlog/wrappers.py     | 17 +++++++++++++----
+ 4 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/colorlog/wrappers.py b/colorlog/wrappers.py
+index 20e3042..63b201a 100644
+--- a/colorlog/wrappers.py
++++ b/colorlog/wrappers.py
+@@ -2,6 +2,7 @@
+ 
+ import functools
+ import logging
++import sys
+ import typing
+ from logging import (
+     CRITICAL,
+@@ -53,8 +54,8 @@ def basicConfig(
+ ) -> None:
+     """Call ``logging.basicConfig`` and override the formatter it creates."""
+     logging.basicConfig(**kwargs)
+-    logging._acquireLock()  # type: ignore
+-    try:
++
++    def _basicConfig():
+         handler = logging.root.handlers[0]
+         handler.setFormatter(
+             colorlog.formatter.ColoredFormatter(
+@@ -67,8 +68,16 @@ def basicConfig(
+                 stream=kwargs.get("stream", None),
+             )
+         )
+-    finally:
+-        logging._releaseLock()  # type: ignore
++
++    if sys.version_info >= (3, 13):
++        with logging._lock:
++            _basicConfig()
++    else:
++        logging._acquireLock()  # type: ignore
++        try:
++            _basicConfig()
++        finally:
++            logging._releaseLock()  # type: ignore
+ 
+ 
+ def ensure_configured(func):


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

end of thread, other threads:[~2024-06-14 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 15:55 [gentoo-commits] repo/gentoo:master commit in: dev-python/colorlog/, dev-python/colorlog/files/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2023-11-24 15:56 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