From dd75f7e2d3d86759467c929397ae22528904f6a187f00263e86c5c63de4a1d0c Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 15 Nov 2024 01:45:03 +0000 Subject: [PATCH] - Add patch support-python313.patch: * Support time.time_ns changes in Python 3.13+. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-json-logger?expand=0&rev=26 --- .gitattributes | 23 ++++++ .gitignore | 1 + python-json-logger-2.0.7.tar.gz | 3 + python-python-json-logger.changes | 116 ++++++++++++++++++++++++++++++ python-python-json-logger.spec | 61 ++++++++++++++++ support-python312.patch | 24 +++++++ support-python313.patch | 83 +++++++++++++++++++++ 7 files changed, 311 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-json-logger-2.0.7.tar.gz create mode 100644 python-python-json-logger.changes create mode 100644 python-python-json-logger.spec create mode 100644 support-python312.patch create mode 100644 support-python313.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-json-logger-2.0.7.tar.gz b/python-json-logger-2.0.7.tar.gz new file mode 100644 index 0000000..caeb43a --- /dev/null +++ b/python-json-logger-2.0.7.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23e7ec02d34237c5aa1e29a070193a4ea87583bb4e7f8fd06d3de8264c4b2e1c +size 10508 diff --git a/python-python-json-logger.changes b/python-python-json-logger.changes new file mode 100644 index 0000000..8251adb --- /dev/null +++ b/python-python-json-logger.changes @@ -0,0 +1,116 @@ +------------------------------------------------------------------- +Fri Nov 15 01:44:06 UTC 2024 - Steve Kowalik + +- Add patch support-python313.patch: + * Support time.time_ns changes in Python 3.13+. + +------------------------------------------------------------------- +Thu Feb 1 01:18:35 UTC 2024 - Steve Kowalik + +- Add patch support-python312.patch: + * Support logging changes in Python 3.12+. + +------------------------------------------------------------------- +Tue Jan 2 22:49:44 UTC 2024 - Dirk Müller + +- require setuptools + +------------------------------------------------------------------- +Thu Jul 20 13:09:51 UTC 2023 - Matej Cepl + +- Clean up the SPEC file. +- Switch to %pyproject_* macros. + +------------------------------------------------------------------- +Wed Jul 19 13:18:33 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Wed May 3 09:09:17 UTC 2023 - Dirk Müller + +- update to 2.0.7: + * Fix inclusion of py.typed in pip packages - @sth + * Added pytest support with test file rename. Migrated to + assertEqual + * Parameter `rename_fields` in merge_record_extra is now + optional - @afallou + * Allow reserved attrs to be renamed - @henkhogan + * Support added for Python 3.11 + * Now verifying builds in Pypy 3.9 as well + * Type annotations are now in the package - @louis-jaris + * Fix rename_fields for exc_info - @guilhermeferrari + * Cleaned up test file for PEP8 - @lopagela + * Cleaned up old Python 2 artifacts - @louis-jaris + * Dropped Python 3.5 support - @idomozes + * Moved type check via tox into 3.11 run only + * Added test run in Python3.6 (will keep for a little while + longer, but it's EOL so upgrade) + +------------------------------------------------------------------- +Thu Oct 6 22:41:33 UTC 2022 - Yogalakshmi Arunachalam + +- Update to 2.0.4 - 2022-07-11 + Changed + Fix too strict regex for percentage style logging - @aberres + +- Update to 2.0.3 - 2022-07-08 + Added + Add PEP 561 marker/basic mypy configuration. - @bringhurst + Workaround logging.LogRecord.msg type of string. - @bringhurst + Changed + Changed a link archive of the reference page in case it's down. - @ahonnecke + Removed unnecessary try-except around OrderedDict usage - @sozofaan + Update documentation link to json module + use https - @deronnax + Dropped 3.5 support. - @bringhurst + +------------------------------------------------------------------- +Sat Nov 6 18:37:44 UTC 2021 - Dirk Müller + +- update to 2.0.2: + * drop python 3.4 support + +------------------------------------------------------------------- +Fri May 28 08:49:54 UTC 2021 - pgajdos@suse.com + +- %check: use %pyunittest rpm macro + +------------------------------------------------------------------- +Mon Dec 21 14:29:29 UTC 2020 - John Vandenberg + +- Disable Python 2 builds +- Add %doc README.md +- Update to v2.0.1 + * Support Pypi long descripton + * rename output fields +- from v2.0.0 + * New Changelog + * Added timezone support to timestamps - @lalten + * Refactored log record to function - @georgysavva + * Add python 3.8 support - @tommilligan + * Removed support for Python 2.7 + * Removed Debian directory + +------------------------------------------------------------------- +Thu May 9 08:26:21 UTC 2019 - pgajdos@suse.com + +- version update to 0.1.11 + * no upstream changelog +- run testsuite +- run spec cleaner +- install LICENSE + +------------------------------------------------------------------- +Tue Dec 4 12:53:05 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Tue Aug 8 06:37:44 UTC 2017 - tbechtold@suse.com + +- fix Requires + +------------------------------------------------------------------- +Fri Jul 28 14:53:26 UTC 2017 - tbechtold@suse.com + +- Initial packaging (version 0.1.7) diff --git a/python-python-json-logger.spec b/python-python-json-logger.spec new file mode 100644 index 0000000..9a0798f --- /dev/null +++ b/python-python-json-logger.spec @@ -0,0 +1,61 @@ +# +# spec file for package python-python-json-logger +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-python-json-logger +Version: 2.0.7 +Release: 0 +Summary: A python library adding a json log formatter +License: BSD-2-Clause +URL: https://github.com/madzak/python-json-logger +Source: https://files.pythonhosted.org/packages/source/p/python-json-logger/python-json-logger-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#madzak/python-json-logger#183 +Patch0: support-python312.patch +# PATCH-FIX-UPSTREAM gh#madzak/python-json-logger#192 +Patch1: support-python313.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +%python_subpackages + +%description +A python library adding a json log formatter. + +%prep +%autosetup -p1 -n python-json-logger-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pyunittest discover -v + +%files %{python_files} +%doc README.md +%license LICENSE +%{python_sitelib}/pythonjsonlogger +%{python_sitelib}/python_json_logger-%{version}.dist-info + +%changelog diff --git a/support-python312.patch b/support-python312.patch new file mode 100644 index 0000000..8aa1455 --- /dev/null +++ b/support-python312.patch @@ -0,0 +1,24 @@ +From 7c8d06925305c578a1dc7a45d6180c2876cfc082 Mon Sep 17 00:00:00 2001 +From: finswimmer +Date: Mon, 9 Oct 2023 13:56:38 +0200 +Subject: [PATCH] feat: add taskName to RESERVED_ATTRS + +taskName was added in Python 3.12 +--- + src/pythonjsonlogger/jsonlogger.py | 1 + + 1 file changed, 1 insertion(+) + +Index: python-json-logger-2.0.7/src/pythonjsonlogger/jsonlogger.py +=================================================================== +--- python-json-logger-2.0.7.orig/src/pythonjsonlogger/jsonlogger.py ++++ python-json-logger-2.0.7/src/pythonjsonlogger/jsonlogger.py +@@ -21,7 +21,8 @@ RESERVED_ATTRS: Tuple[str, ...] = ( + 'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename', + 'funcName', 'levelname', 'levelno', 'lineno', 'module', + 'msecs', 'message', 'msg', 'name', 'pathname', 'process', +- 'processName', 'relativeCreated', 'stack_info', 'thread', 'threadName') ++ 'processName', 'relativeCreated', 'stack_info', 'thread', 'threadName', ++ 'taskName') + + + diff --git a/support-python313.patch b/support-python313.patch new file mode 100644 index 0000000..a462331 --- /dev/null +++ b/support-python313.patch @@ -0,0 +1,83 @@ +From a03831c0101e44643216ce1ffde93f549cf3b35a Mon Sep 17 00:00:00 2001 +From: Karolina Surma <33810531+befeleme@users.noreply.github.com> +Date: Mon, 10 Jun 2024 12:59:47 +0200 +Subject: [PATCH 1/3] Make tests work with Python 3.13 + +Attribute `created` of LogRecord is `time.time_ns` since Python 3.13: https://docs.python.org/3.13/library/logging.html#logrecord-attributes +--- + tests/test_jsonlogger.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_jsonlogger.py b/tests/test_jsonlogger.py +index af369d2..0711d49 100644 +--- a/tests/test_jsonlogger.py ++++ b/tests/test_jsonlogger.py +@@ -175,7 +175,7 @@ def test_json_default_encoder(self): + self.assertEqual(log_json.get("otherdatetimeagain"), + "1900-01-01T00:00:00") + +- @unittest.mock.patch('time.time', return_value=1500000000.0) ++ @unittest.mock.patch('time.time_ns', return_value=1500000000000000000.0) + def test_json_default_encoder_with_timestamp(self, time_mock): + fr = jsonlogger.JsonFormatter(timestamp=True) + self.log_handler.setFormatter(fr) + +From 08d7344f0750237d8e4b0fdf8407402874fec1ea Mon Sep 17 00:00:00 2001 +From: Karolina Surma <33810531+befeleme@users.noreply.github.com> +Date: Mon, 10 Jun 2024 13:35:51 +0200 +Subject: [PATCH 2/3] Add the backwards compatibility for the patched method + +This will work with Python < 3.13. +--- + tests/test_jsonlogger.py | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/tests/test_jsonlogger.py b/tests/test_jsonlogger.py +index 0711d49..b316751 100644 +--- a/tests/test_jsonlogger.py ++++ b/tests/test_jsonlogger.py +@@ -175,14 +175,18 @@ def test_json_default_encoder(self): + self.assertEqual(log_json.get("otherdatetimeagain"), + "1900-01-01T00:00:00") + ++ @unittest.mock.patch('time.time', return_value=1500000000.0) + @unittest.mock.patch('time.time_ns', return_value=1500000000000000000.0) +- def test_json_default_encoder_with_timestamp(self, time_mock): ++ def test_json_default_encoder_with_timestamp(self, time_ns_mock, time_mock): + fr = jsonlogger.JsonFormatter(timestamp=True) + self.log_handler.setFormatter(fr) + + self.log.info("Hello") +- +- self.assertTrue(time_mock.called) ++ ++ if sys.version_info < (3, 13): ++ self.assertTrue(time_mock.called) ++ else: ++ self.assertTrue(time_ns_mock.called) + log_json = json.loads(self.buffer.getvalue()) + self.assertEqual(log_json.get("timestamp"), "2017-07-14T02:40:00+00:00") + + +From 2f24daf7a0f4d3cb717eeaaa2dbd1b69da1a5b71 Mon Sep 17 00:00:00 2001 +From: Karolina Surma <33810531+befeleme@users.noreply.github.com> +Date: Mon, 10 Jun 2024 13:37:14 +0200 +Subject: [PATCH 3/3] Return value of time.time_ns is int + +--- + tests/test_jsonlogger.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_jsonlogger.py b/tests/test_jsonlogger.py +index b316751..068e760 100644 +--- a/tests/test_jsonlogger.py ++++ b/tests/test_jsonlogger.py +@@ -176,7 +176,7 @@ def test_json_default_encoder(self): + "1900-01-01T00:00:00") + + @unittest.mock.patch('time.time', return_value=1500000000.0) +- @unittest.mock.patch('time.time_ns', return_value=1500000000000000000.0) ++ @unittest.mock.patch('time.time_ns', return_value=1500000000000000000) + def test_json_default_encoder_with_timestamp(self, time_ns_mock, time_mock): + fr = jsonlogger.JsonFormatter(timestamp=True) + self.log_handler.setFormatter(fr)