15
0

- Add patch stop-using-imp.patch:

* Stop using imp module, switch to importlib.*
- Use pyproject macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pathtools?expand=0&rev=15
This commit is contained in:
2023-08-16 05:18:32 +00:00
committed by Git OBS Bridge
parent 67be70a7e6
commit 02d6798d24
3 changed files with 40 additions and 5 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Aug 16 05:17:49 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch stop-using-imp.patch:
* Stop using imp module, switch to importlib.*
- Use pyproject macros.
-------------------------------------------------------------------
Fri Jun 9 05:54:46 UTC 2023 - ecsos <ecsos@opensuse.org>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pathtools
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,11 @@ Summary: File system general utilities
License: MIT
URL: https://github.com/gorakhargosh/pathtools
Source: https://files.pythonhosted.org/packages/source/p/pathtools/pathtools-%{version}.tar.gz
# PATCH-FIX-OPENSUSE Stop using imp module
Patch0: stop-using-imp.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-Sphinx
@@ -35,22 +39,22 @@ BuildArch: noarch
Pattern matching and various utilities for file systems paths.
%prep
%setup -q -n pathtools-%{version}
%autosetup -p1 -n pathtools-%{version}
sed -i "1d" pathtools/path.py pathtools/patterns.py
sed -i "s/^html_theme.*/#html_theme/" docs/source/conf.py
%build
%python_build
%pyproject_wheel
cd docs && make html && rm -r build/html/.buildinfo # Build HTML docs
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%files %{python_files}
%license LICENSE
%doc AUTHORS README docs/build/html
%{python_sitelib}/pathtools
%{python_sitelib}/pathtools-%{version}-py%{python_version}.egg-info
%{python_sitelib}/pathtools-%{version}.dist-info
%changelog

24
stop-using-imp.patch Normal file
View File

@@ -0,0 +1,24 @@
Index: pathtools-0.1.2/setup.py
===================================================================
--- pathtools-0.1.2.orig/setup.py
+++ pathtools-0.1.2/setup.py
@@ -22,12 +22,16 @@
# THE SOFTWARE.
import os
-import imp
+import importlib.machinery
+import importlib.util
from setuptools import setup
PKG_DIR = 'pathtools'
-version = imp.load_source('version',
- os.path.join(PKG_DIR, 'version.py'))
+path = os.path.join(PKG_DIR, 'version.py')
+loader = importlib.machinery.SourceFileLoader("pathtools", path)
+spec = importlib.util.spec_from_file_location("pathtools", path)
+version = importlib.util.module_from_spec(spec)
+loader.exec_module(version)
def read_file(filename):
"""