14
0

Compare commits

...

12 Commits

Author SHA256 Message Date
2dff85b05b Accepting request 1224339 from devel:languages:python
- Add patch support-python313.patch:
  * Support time.time_ns changes in Python 3.13+.

OBS-URL: https://build.opensuse.org/request/show/1224339
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=12
2024-11-17 15:39:42 +00:00
330bb6f6fe - 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
2024-11-15 01:45:03 +00:00
541c2df12e Accepting request 1143998 from devel:languages:python
- Add patch support-python312.patch:
  * Support logging changes in Python 3.12+.

OBS-URL: https://build.opensuse.org/request/show/1143998
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=11
2024-02-05 21:00:54 +00:00
388e847d84 Accepting request 1136323 from devel:languages:python
- require setuptools

  Dropped 3.5 support. - @bringhurst
  * drop python 3.4 support

OBS-URL: https://build.opensuse.org/request/show/1136323
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=10
2024-01-03 11:31:11 +00:00
941b688c22 Accepting request 1099747 from devel:languages:python
- Clean up the SPEC file.
- Switch to %pyproject_* macros.

- Add %{?sle15_python_module_pythons}

OBS-URL: https://build.opensuse.org/request/show/1099747
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=9
2023-07-25 09:49:12 +00:00
5710a43b62 Accepting request 1084222 from devel:languages:python
- 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)

OBS-URL: https://build.opensuse.org/request/show/1084222
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=8
2023-05-03 10:57:53 +00:00
bc49eeee05 Accepting request 1008710 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1008710
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=7
2022-10-07 23:25:28 +00:00
40319531f9 Accepting request 929916 from devel:languages:python
- update to 2.0.2:
  * drop python 3.4 support

OBS-URL: https://build.opensuse.org/request/show/929916
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=6
2021-11-06 23:19:13 +00:00
c682193441 Accepting request 895935 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/895935
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=5
2021-06-01 08:37:59 +00:00
a9119be84c Accepting request 857878 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/857878
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=4
2020-12-22 10:51:53 +00:00
b7a83be517 Accepting request 701757 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/701757
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=3
2019-05-10 07:19:35 +00:00
d46ebe528b Accepting request 659614 from devel:languages:python
Remove superfluous devel dependency for noarch package

OBS-URL: https://build.opensuse.org/request/show/659614
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-json-logger?expand=0&rev=2
2018-12-24 10:42:37 +00:00
3 changed files with 91 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 15 01:44:06 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python313.patch:
* Support time.time_ns changes in Python 3.13+.
-------------------------------------------------------------------
Thu Feb 1 01:18:35 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -26,6 +26,8 @@ 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}

83
support-python313.patch Normal file
View File

@@ -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)