14
0

- Update to 1.8.1:

* Adding pytest integration to turn of networking tests
  * Fix missing issuer problem in deserialize function
  * Add a CL tool to verify SciTokens
  * Fix issue in creating the cache file location
  * Add convenience functions to issue demo tokens
  * Adding python scitokens spec file changes for review
- Drop patch use-importlib-metadata.patch, included upstream.
- Switch to pyproject macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-scitokens?expand=0&rev=13
This commit is contained in:
2024-10-10 03:12:39 +00:00
committed by Git OBS Bridge
parent 29ed77b832
commit e6918afdc1
5 changed files with 34 additions and 73 deletions

View File

@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Oct 10 03:11:39 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.8.1:
* Adding pytest integration to turn of networking tests
* Fix missing issuer problem in deserialize function
* Add a CL tool to verify SciTokens
* Fix issue in creating the cache file location
* Add convenience functions to issue demo tokens
* Adding python scitokens spec file changes for review
- Drop patch use-importlib-metadata.patch, included upstream.
- Switch to pyproject macros.
-------------------------------------------------------------------
Wed Apr 12 04:56:08 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-scitokens
#
# Copyright (c) 2023 SUSE LLC
# 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
@@ -19,23 +19,27 @@
%define bname scitokens
Name: python-scitokens
Version: 1.7.4
Version: 1.8.1
Release: 0
Summary: SciToken reference implementation library
License: Apache-2.0
URL: https://scitokens.org
Source: https://github.com/scitokens/scitokens/archive/refs/tags/v%{version}.tar.gz#/%{bname}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM Do not use pkg_resources gh#scitokens/scitokens#182
Patch0: use-importlib-metadata.patch
BuildRequires: %{python_module PyJWT >= 2.2}
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyJWT >= 2.2
Requires: python-cryptography
Requires: python-requests
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
@@ -49,28 +53,33 @@ want to delegate trust for an issuer for managing a storage allocation.
%autosetup -p1 -n scitokens-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/scitokens-admin-create-key
%python_clone -a %{buildroot}%{_bindir}/scitokens-admin-create-token
%python_clone -a %{buildroot}%{_bindir}/scitokens-verify-token
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%pytest -k 'not network'
%post
%python_install_alternative scitokens-admin-create-key
%python_install_alternative scitokens-admin-create-token
%python_install_alternative scitokens-verify-token
%postun
%python_uninstall_alternative scitokens-admin-create-key
%python_uninstall_alternative scitokens-admin-create-token
%python_uninstall_alternative scitokens-verify-token
%files %{python_files}
%{python_sitelib}/scitokens*
%{python_sitelib}/scitokens
%{python_sitelib}/scitokens-%{version}.dist-info
%python_alternative %{_bindir}/scitokens-admin-create-key
%python_alternative %{_bindir}/scitokens-admin-create-token
%python_alternative %{_bindir}/scitokens-verify-token
%changelog

View File

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

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

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

View File

@@ -1,61 +0,0 @@
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'