diff --git a/no-pkg_resources.patch b/no-pkg_resources.patch new file mode 100644 index 0000000..968d03d --- /dev/null +++ b/no-pkg_resources.patch @@ -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 diff --git a/python-passlib.changes b/python-passlib.changes index e3f37ef..f3f2d1a 100644 --- a/python-passlib.changes +++ b/python-passlib.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Aug 3 06:29:11 UTC 2023 - Steve Kowalik + +- Add patch no-pkg_resources.patch: + * Stop using pkg_resources. +- Switch to pyproject macros. + ------------------------------------------------------------------- Tue May 9 13:39:14 UTC 2023 - Johannes Kastl diff --git a/python-passlib.spec b/python-passlib.spec index 99fe220..3e66b57 100644 --- a/python-passlib.spec +++ b/python-passlib.spec @@ -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