14
0

- Switch to autosetup and pyproject macros.

- Set this package to noarch, since it doesn't ship any arch-dep files.
- Add patch support-python-313.patch:
  * Support Python 3.13's logging changes.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-colorlog?expand=0&rev=28
This commit is contained in:
2024-10-29 04:30:41 +00:00
committed by Git OBS Bridge
parent a8c266f903
commit 1ec0a017b6
3 changed files with 71 additions and 4 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Oct 29 04:28:54 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to autosetup and pyproject macros.
- Set this package to noarch, since it doesn't ship any arch-dep files.
- Add patch support-python-313.patch:
* Support Python 3.13's logging changes.
-------------------------------------------------------------------
Tue Jan 30 12:20:13 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@@ -24,10 +24,15 @@ Summary: Log formatting with colors
License: MIT
URL: https://github.com/borntyping/python-colorlog
Source: https://files.pythonhosted.org/packages/source/c/colorlog/colorlog-%{version}.tar.gz
# PATCH-FIX-UPSTREAM Partial patch from gh#borntyping/python-colorlog#607485def2d60b60c40c0d682574324b47fc30ba
Patch0: support-python-313.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
@@ -38,13 +43,13 @@ This is accomplished by added a set of terminal color codes to the record
before it is used to format the string.
%prep
%setup -q -n colorlog-%{version}
%autosetup -p1 -n colorlog-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -54,6 +59,6 @@ before it is used to format the string.
%doc README.md
%license LICENSE
%{python_sitelib}/colorlog
%{python_sitelib}/colorlog-%{version}-py%{python_version}.egg-info
%{python_sitelib}/colorlog-%{version}.dist-info
%changelog

54
support-python-313.patch Normal file
View File

@@ -0,0 +1,54 @@
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
---
.github/workflows/ci.yml | 2 ++
colorlog/wrappers.py | 17 +++++++++++++----
setup.py | 2 +-
tox.ini | 2 +-
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):