From 41f15c54297c4208e205fd3c5357f72e14a7472b36859aebf6e42066e6629441 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Tue, 27 Feb 2024 13:57:17 +0000 Subject: [PATCH] Accepting request 1152302 from home:bnavigator:branches:science - Fix cryptography deprecation sent to duncan.macleod@ligo.org igwn-auth-utils-cryptography-utc-deprecation.patch OBS-URL: https://build.opensuse.org/request/show/1152302 OBS-URL: https://build.opensuse.org/package/show/science/python-igwn-auth-utils?expand=0&rev=10 --- ...h-utils-cryptography-utc-deprecation.patch | 23 +++++++++++++++++++ python-igwn-auth-utils.changes | 6 +++++ python-igwn-auth-utils.spec | 2 ++ 3 files changed, 31 insertions(+) create mode 100644 igwn-auth-utils-cryptography-utc-deprecation.patch diff --git a/igwn-auth-utils-cryptography-utc-deprecation.patch b/igwn-auth-utils-cryptography-utc-deprecation.patch new file mode 100644 index 0000000..1092758 --- /dev/null +++ b/igwn-auth-utils-cryptography-utc-deprecation.patch @@ -0,0 +1,23 @@ +Index: igwn-auth-utils-1.1.0/igwn_auth_utils/x509.py +=================================================================== +--- igwn-auth-utils-1.1.0.orig/igwn_auth_utils/x509.py ++++ igwn-auth-utils-1.1.0/igwn_auth_utils/x509.py +@@ -95,13 +95,12 @@ def is_valid_certificate(cert, timeleft= + def _timeleft(cert): + """Returns the time remaining (in seconds) for a ``cert`` + """ +- expiry = cert.not_valid_after + try: +- now = datetime.datetime.now(datetime.UTC) +- except AttributeError: # python < 3.11 +- now = datetime.datetime.utcnow() +- else: +- expiry = expiry.astimezone(datetime.UTC) ++ expiry = cert.not_valid_after_utc ++ except AttributeError: ++ # cryptography < 42 ++ expiry = cert.not_valid_after ++ now = datetime.datetime.now(datetime.timezone.utc) + return (expiry - now).total_seconds() + + diff --git a/python-igwn-auth-utils.changes b/python-igwn-auth-utils.changes index e4c2eb3..cbdab13 100644 --- a/python-igwn-auth-utils.changes +++ b/python-igwn-auth-utils.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Feb 27 13:29:40 UTC 2024 - Ben Greiner + +- Fix cryptography deprecation sent to duncan.macleod@ligo.org + igwn-auth-utils-cryptography-utc-deprecation.patch + ------------------------------------------------------------------- Wed Feb 14 11:14:43 UTC 2024 - Ben Greiner diff --git a/python-igwn-auth-utils.spec b/python-igwn-auth-utils.spec index b64c97f..44c74cc 100644 --- a/python-igwn-auth-utils.spec +++ b/python-igwn-auth-utils.spec @@ -28,6 +28,8 @@ Source: https://files.pythonhosted.org/packages/source/i/%{srcname}/%{sr Patch0: https://git.ligo.org/computing/igwn-auth-utils/-/merge_requests/73.patch#/igwn-auth-utils-mr73-utznow.patch # PATCH-FIX-UPSTREAM igwn-auth-utils-mr76-mock_called_once.patch https://git.ligo.org/computing/igwn-auth-utils/-/merge_requests/76 Patch1: https://git.ligo.org/computing/igwn-auth-utils/-/merge_requests/76.patch#/igwn-auth-utils-mr76-mock_called_once.patch +# PATCH-FIX-UPSTREAM igwn-auth-utils-cryptography-utc-deprecation.patch sent to duncan.macleod@ligo.org +Patch2: igwn-auth-utils-cryptography-utc-deprecation.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools_scm >= 3.4.3} BuildRequires: %{python_module setuptools}