14
0

- Update to 1.7.4:

* Remove aud enforcement from deserialize function
  * Reduce length of comment line
  * Update minimum pyjwt
  * Remove use of six 
- Drop patch python-scitokens-no-six.patch, included upstream
- Add patch use-importlib-metadata.patch:
  * Use importlib.metadata, rather than pkg_resources.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-scitokens?expand=0&rev=11
This commit is contained in:
2023-04-12 04:59:38 +00:00
committed by Git OBS Bridge
parent 1508d48d36
commit 29ed77b832
6 changed files with 83 additions and 93 deletions

View File

@@ -1,78 +0,0 @@
Index: scitokens-1.7.2/requirements.txt
===================================================================
--- scitokens-1.7.2.orig/requirements.txt
+++ scitokens-1.7.2/requirements.txt
@@ -1,3 +1,2 @@
cryptography
PyJWT>=1.6.1
-six
Index: scitokens-1.7.2/setup.py
===================================================================
--- scitokens-1.7.2.orig/setup.py
+++ scitokens-1.7.2/setup.py
@@ -64,7 +64,6 @@ setuptools.setup(
install_requires=[
'cryptography',
'PyJWT>=1.6.1',
- 'six',
'setuptools'
],
# classifiers
Index: scitokens-1.7.2/src/scitokens/scitokens.py
===================================================================
--- scitokens-1.7.2.orig/src/scitokens/scitokens.py
+++ scitokens-1.7.2/src/scitokens/scitokens.py
@@ -12,7 +12,6 @@ import os
import jwt
from . import urltools
import logging
-from six import string_types
LOGGER = logging.getLogger("scitokens")
import uuid
@@ -697,7 +696,7 @@ class Enforcer(object):
return True
def _validate_scope(self, value):
- if not isinstance(value, string_types):
+ if not isinstance(value, str):
raise InvalidAuthorizationResource("Scope is invalid. Must be a space separated string")
if self._test_access:
if not self._test_path:
Index: scitokens-1.7.2/src/scitokens/utils/config.py
===================================================================
--- scitokens-1.7.2.orig/src/scitokens/utils/config.py
+++ scitokens-1.7.2/src/scitokens/utils/config.py
@@ -5,8 +5,7 @@ Module for configuration management
# Config parser is renamed in python 3
-from six.moves import configparser
-import six
+import configparser
import logging
import logging.handlers
@@ -30,7 +29,7 @@ def set_config(config = None):
"""
global configuration # pylint: disable=C0103
- if isinstance(config, six.string_types):
+ if isinstance(config, str):
configuration = configparser.ConfigParser(CONFIG_DEFAULTS)
configuration.read([config])
elif isinstance(config, configparser.RawConfigParser):
Index: scitokens-1.7.2/tests/test_config.py
===================================================================
--- scitokens-1.7.2.orig/tests/test_config.py
+++ scitokens-1.7.2/tests/test_config.py
@@ -8,8 +8,7 @@ import tempfile
import logging
import scitokens
import scitokens.utils.config
-
-from six.moves import configparser
+import configparser
class TestConfig(unittest.TestCase):
"""

View File

@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Wed Apr 12 04:56:08 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.7.4:
* Remove aud enforcement from deserialize function
* Reduce length of comment line
* Update minimum pyjwt
* Remove use of six
- Drop patch python-scitokens-no-six.patch, included upstream
- Add patch use-importlib-metadata.patch:
* Use importlib.metadata, rather than pkg_resources.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Nov 14 08:47:39 UTC 2022 - pgajdos@suse.com Mon Nov 14 08:47:39 UTC 2022 - pgajdos@suse.com

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-scitokens # spec file for package python-scitokens
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2023 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -18,25 +18,21 @@
%define bname scitokens %define bname scitokens
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-scitokens Name: python-scitokens
Version: 1.7.2 Version: 1.7.4
Release: 0 Release: 0
Summary: SciToken reference implementation library Summary: SciToken reference implementation library
License: Apache-2.0 License: Apache-2.0
URL: https://scitokens.org URL: https://scitokens.org
Source: https://github.com/scitokens/scitokens/archive/refs/tags/v%{version}.tar.gz#/%{bname}-%{version}.tar.gz Source: https://github.com/scitokens/scitokens/archive/refs/tags/v%{version}.tar.gz#/%{bname}-%{version}.tar.gz
# https://github.com/scitokens/scitokens/issues/169 # PATCH-FIX-UPSTREAM Do not use pkg_resources gh#scitokens/scitokens#182
Patch0: python-scitokens-no-six.patch Patch0: use-importlib-metadata.patch
BuildRequires: %{python_module PyJWT} BuildRequires: %{python_module PyJWT >= 2.2}
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-PyJWT Requires: python-PyJWT >= 2.2
Requires: python-six
BuildArch: noarch BuildArch: noarch
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun):update-alternatives Requires(postun):update-alternatives
@@ -50,8 +46,7 @@ federated environment where several otherwise-independent storage endpoints
want to delegate trust for an issuer for managing a storage allocation. want to delegate trust for an issuer for managing a storage allocation.
%prep %prep
%setup -q -n scitokens-%{version} %autosetup -p1 -n scitokens-%{version}
%patch0 -p1
%build %build
%python_build %python_build

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66ff0b5300253ac0a043688071d62a3eb14fdf965e2e320dcaa87de8f2e874c1
size 51044

3
scitokens-1.7.4.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e9685831addb2720a03bbfbb18e8c36a34e5a308c1e67ba003e8aea8e5d1ccfb
size 51476

View File

@@ -0,0 +1,61 @@
From 8f909b3d81fa21af91e1e96a85168e7643faf9d3 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Wed, 12 Apr 2023 13:57:02 +1000
Subject: [PATCH] Use importlib.metadata rather than pkg_resources
pkg_resources is a deprecated API, and a rather heavyweight one. Since
Python 3.8, the standard library has included importlib.metadata, which
can do the same functionality we're looking for here. Since we continue
to support older versions of Python, fallback to importlib_metadata if
required.
---
requirements.txt | 1 +
setup.py | 1 +
src/scitokens/utils/keycache.py | 11 ++++++++---
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index d767b78..4e260fe 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
cryptography
+importlib_metadata;python_version<'3.8'
PyJWT>=2.2.0
diff --git a/setup.py b/setup.py
index ad046e6..0ad28c7 100644
--- a/setup.py
+++ b/setup.py
@@ -66,6 +66,7 @@ def find_version(path, varname="__version__"):
install_requires=[
'cryptography',
'PyJWT>=1.6.1',
+ "importlib_metadata;python_version<'3.8'",
'setuptools'
],
extras_require={
diff --git a/src/scitokens/utils/keycache.py b/src/scitokens/utils/keycache.py
index 398980f..56385f9 100644
--- a/src/scitokens/utils/keycache.py
+++ b/src/scitokens/utils/keycache.py
@@ -6,12 +6,17 @@
import os
import sqlite3
import time
-import pkg_resources # part of setuptools
import re
import logging
+
+try:
+ import importlib.metadata as import_meta
+except ImportError:
+ import importlib_metadata as import_meta
+
try:
- PKG_VERSION = pkg_resources.require("scitokens")[0].version
-except pkg_resources.DistributionNotFound as error:
+ PKG_VERSION = import_meta.version("scitokens")
+except import_meta.PackageNotFoundError:
# During testing, scitokens won't be installed, so requiring it will fail
# Instead, fake it
PKG_VERSION = '1.0.0'