Accepting request 1102111 from devel:languages:python

- Add patch no-pkg_resources.patch:
  * Stop using pkg_resources.
- Switch to pyproject macros.

OBS-URL: https://build.opensuse.org/request/show/1102111
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-passlib?expand=0&rev=28
This commit is contained in:
Dominique Leuenberger 2023-08-03 15:29:25 +00:00 committed by Git OBS Bridge
commit a3c66325f7
3 changed files with 45 additions and 5 deletions

30
no-pkg_resources.patch Normal file
View File

@ -0,0 +1,30 @@
Index: passlib-1.7.4/passlib/pwd.py
===================================================================
--- passlib-1.7.4.orig/passlib/pwd.py
+++ passlib-1.7.4/passlib/pwd.py
@@ -13,8 +13,8 @@ except ImportError:
from collections import MutableMapping
from math import ceil, log as logf
import logging; log = logging.getLogger(__name__)
-import pkg_resources
import os
+import sys
# site
# pkg
from passlib import exc
@@ -122,7 +122,14 @@ def _open_asset_path(path, encoding=None
if not sep:
raise ValueError("asset path must be absolute file path "
"or use 'pkg.name:sub/path' format: %r" % (path,))
- return pkg_resources.resource_stream(package, subpath)
+ if sys.version_info >= (3, 9):
+ # We can use the new and shiny importlib.resources
+ import importlib.resources
+ return importlib.resources.files(package).joinpath(subpath).open('rb')
+ else:
+ # Fallback to pkg_resources
+ import pkg_resources
+ return pkg_resources.resource_stream(package, subpath)
#: type aliases

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 3 06:29:11 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch no-pkg_resources.patch:
* Stop using pkg_resources.
- Switch to pyproject macros.
-------------------------------------------------------------------
Tue May 9 13:39:14 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>

View File

@ -32,10 +32,13 @@ Version: 1.7.4
Release: 0
Summary: Password hashing framework supporting over 20 schemes
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://foss.heptapod.net/python-libs/passlib
Source: https://files.pythonhosted.org/packages/source/p/passlib/passlib-%{version}.tar.gz
# PATCH-FIX-OPENSUSE Posted to https://foss.heptapod.net/python-libs/passlib/-/issues/185
Patch0: no-pkg_resources.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
@ -64,14 +67,14 @@ found in %{_sysconfdir}/shadow, and provide password hashing for
applications.
%prep
%setup -q -n passlib-%{version}
%autosetup -p1 -n passlib-%{version}
%build
%python_build
%pyproject_wheel
%install
%if !%{with test}
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
@ -87,7 +90,7 @@ applications.
%license LICENSE
%doc README
%{python_sitelib}/passlib
%{python_sitelib}/passlib-%{version}-py%{python_version}.egg-info
%{python_sitelib}/passlib-%{version}.dist-info
%endif
%changelog