17
0

Compare commits

2 Commits

Author SHA256 Message Date
4ee962b70b Accepting request 1231591 from devel:languages:python
- No longer skip building for Python 3.12.
- Switch to pyproject and autosetup macros.
- Add patch use-importlib.patch:
  * Use importlib, rather than imp.

OBS-URL: https://build.opensuse.org/request/show/1231591
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sat-search?expand=0&rev=4
2024-12-17 18:23:33 +00:00
6e66e85834 - No longer skip building for Python 3.12.
- Switch to pyproject and autosetup macros.
- Add patch use-importlib.patch:
  * Use importlib, rather than imp.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sat-search?expand=0&rev=9
2024-12-17 01:54:27 +00:00
3 changed files with 52 additions and 5 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Dec 17 01:53:28 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- No longer skip building for Python 3.12.
- Switch to pyproject and autosetup macros.
- Add patch use-importlib.patch:
* Use importlib, rather than imp.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Mar 14 10:06:06 UTC 2024 - Dirk Müller <dmueller@suse.com> Thu Mar 14 10:06:06 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@@ -18,7 +18,6 @@
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
%define packagename sat-search %define packagename sat-search
%global skip_python312 1
Name: python-sat-search Name: python-sat-search
Version: 0.3.0 Version: 0.3.0
Release: 0 Release: 0
@@ -27,9 +26,13 @@ License: MIT
URL: https://github.com/sat-utils/sat-search URL: https://github.com/sat-utils/sat-search
Source: https://files.pythonhosted.org/packages/source/s/sat-search/sat-search-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/s/sat-search/sat-search-%{version}.tar.gz
Source99: https://raw.githubusercontent.com/sat-utils/sat-search/master/LICENSE Source99: https://raw.githubusercontent.com/sat-utils/sat-search/master/LICENSE
# PATCH-FIX-UPSTREAM gh#sat-utils/sat-search#136
Patch0: use-importlib.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest >= 2.8.2} BuildRequires: %{python_module pytest >= 2.8.2}
BuildRequires: %{python_module sat-stac} BuildRequires: %{python_module sat-stac}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-sat-stac Requires: python-sat-stac
@@ -44,16 +47,16 @@ and downloading publicly available satellite imagery using a conformant
API such as sat-api. API such as sat-api.
%prep %prep
%setup -q -n %{packagename}-%{version} %autosetup -p1 -n %{packagename}-%{version}
cp %{SOURCE99} . cp %{SOURCE99} .
sed -i -e '/pytest-runner/d' setup.py sed -i -e '/pytest-runner/d' setup.py
%build %build
%python_build %pyproject_wheel
%install %install
%python_install %pyproject_install
for p in %{packagename} ; do for p in %{packagename} ; do
%python_clone -a %{buildroot}%{_bindir}/$p %python_clone -a %{buildroot}%{_bindir}/$p
done done
@@ -76,6 +79,6 @@ done
%license LICENSE %license LICENSE
%python_alternative %{_bindir}/%{packagename} %python_alternative %{_bindir}/%{packagename}
%{python_sitelib}/satsearch %{python_sitelib}/satsearch
%{python_sitelib}/*egg-info %{python_sitelib}/sat_search-%{version}.dist-info
%changelog %changelog

36
use-importlib.patch Normal file
View File

@@ -0,0 +1,36 @@
From 485ffadccbc95b738a63b6c9513a728f7e455ebc Mon Sep 17 00:00:00 2001
From: Victor Engmark <victor@engmark.name>
Date: Fri, 6 Sep 2024 09:10:02 +1200
Subject: [PATCH] fix: Use new importlib
As recommended by <https://docs.python.org/3/whatsnew/3.12.html#imp>.
---
setup.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 9feb1c8..dcc951c 100755
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,20 @@
#!/usr/bin/env python
+import importlib.util
+import importlib.machinery
from setuptools import setup, find_packages
-from imp import load_source
from os import path
import io
+def load_source(modname, filename):
+ loader = importlib.machinery.SourceFileLoader(modname, filename)
+ spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
+ module = importlib.util.module_from_spec(spec)
+ # The module is always executed and not cached in sys.modules.
+ # Uncomment the following line to cache the module.
+ # sys.modules[module.__name__] = module
+ loader.exec_module(module)
+ return module
+
__version__ = load_source('satsearch.version', 'satsearch/version.py').__version__
here = path.abspath(path.dirname(__file__))