From aa9fc0e93913d432c2d3e140efb2e9af2b095902155675684c2e433d3eaffe14 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 16 Aug 2023 05:18:32 +0000 Subject: [PATCH] - 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 --- python-pathtools.changes | 7 +++++++ python-pathtools.spec | 14 +++++++++----- stop-using-imp.patch | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 stop-using-imp.patch diff --git a/python-pathtools.changes b/python-pathtools.changes index a272671..06545a1 100644 --- a/python-pathtools.changes +++ b/python-pathtools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Aug 16 05:17:49 UTC 2023 - Steve Kowalik + +- 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 diff --git a/python-pathtools.spec b/python-pathtools.spec index 030e2a6..2297725 100644 --- a/python-pathtools.spec +++ b/python-pathtools.spec @@ -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 diff --git a/stop-using-imp.patch b/stop-using-imp.patch new file mode 100644 index 0000000..c00a5e8 --- /dev/null +++ b/stop-using-imp.patch @@ -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): + """